Can't use recursion in Python


#1

Python does not allow for recursion. Keep getting a Runtime Error on how the function is not defined.


#2

you might check the code once again.python recursion is not the problem may be you are getting infinite loop due to a missed base condition.


#3

This is because function is a part of a class. Try calling it like self.function().


#4

this one line solution so good for python programmers

return self.gcd(B,A%B) if A and B else max(A,B)


#5

nice one liner, thanks for sharing !!