Recurrsion in python
The function calling itself called recurrsion.
import sys
# set recursion limit
sys.setrecursionlimit(2000)
print(sys.getrecursionlimit())
i = 0
def greet():
global i
i+=1
print("hello",i)
greet()
greet()
hello hello hello ....
The function calling itself called recurrsion.
import sys
# set recursion limit
sys.setrecursionlimit(2000)
print(sys.getrecursionlimit())
i = 0
def greet():
global i
i+=1
print("hello",i)
greet()
greet()
hello hello hello ....
Post a Comment