Max recursion error depth exceeded, python(2.7.5)
So I am trying to find the least common multiple of the numbers 1 - 20.
For some reason my code exceeds the max recursion depth but I don't
understand why. I just don't see where it gets stuck in the while loop.
def checking(i,q,w,e):
q = q * w
while i < 20:
if q % i != 0:
w += 1.0
checking(1.0, 20.0, w, [])
if q % i == 0 and i < 19:
i += 1
if q % i == 0 and i == 19:
e.append(q)
break
checking(1.0, 20.0, 1.0, [])
No comments:
Post a Comment