import sys
num = long(raw_input("Enter the number for the factorial -> "))
sys.setrecursionlimit(num + 1)
def fact(n):
if n == 0 or n == 1:
return 1
else:
return (n * fact(n - 1))
print fact(long(num))
Above is the code I used for finding factorial and since the maximum recursion limit depth is '997', I tried to change that using :-
import sys
sys.setrecursionlimit()
But it still gives error. What else can I do ?