pythonconverters

Why did the output of python 2 to 3 converter show "invalid syntax"? How can I deal with the error "name 'Partitions' is not defined"?


I tried to use https://python2to3.com/ to convert python 2 code from the following link to python 3. https://people.math.sc.edu/czabarka/programfiles/binary.html I wonder why did the output of the converter show "invalid syntax"?
for j in [0..floor(i/3)] and for m in [j..floor((i-j)/2)] are both invalid, right? I can replace for j in [0..floor(i/3)] with for j in range(0,1+floor(i/3)) , right? I also convert the python 2 code from https://people.math.sc.edu/czabarka/programfiles/nonbinary.html to python 3. I got an error "name 'Partitions' is not defined" when running the converted code with G(30,1). How can I deal with the code Partitions(i).cardinality()?


Solution

  • for j in [0..floor(i/3)]: is not valid Python syntax. The file you linked has never been run successfully with any version of Python.