Python: Maximum recursion depth exceeded Python: Maximum recursion depth exceeded python python

Python: Maximum recursion depth exceeded


You can increment the stack depth allowed - with this, deeper recursive calls will be possible, like this:

import syssys.setrecursionlimit(10000) # 10000 is an example, try with different values

... But I'd advise you to first try to optimize your code, for instance, using iteration instead of recursion.