1.

How to set the limit for recursive function? Give an example?

Answer»

Python also allows you to change the limit using 

sys.setrecursionlimit (limit value).

Example:

import sys

sys.setrecursionlimit(3000)

def fact (n):

if n = = 0:

return 1

else:

return n * fact (n – 1)

print (fact (2000))



Discussion

No Comment Found