Dec-13-2021, 01:50 AM
I have some code which I believe to be from Python 2 and need to move it to Python 3. I do not code in Python, or I stumble through very simple routines with some luck.
The code below gives me several errors in Python 3. Any suggestions or things I need to address? Any help would be greatly appreciated.
The code below gives me several errors in Python 3. Any suggestions or things I need to address? Any help would be greatly appreciated.
p, q = 1, 3 a, b, a1, b1 = 4, 1, 12, 4 for i in range(10000): p, q = p+q, q+2 # next convergent a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1 while 1: d = a//b r = a1 - d*b1 # break if a//b != a1//b1 if r < 0 or r >= b1: break print d, # common digits a, a1 = 10*(a-d*b), 10*r