Function call itself Repeated way is known as Recursive Function :
- Recursive Example One :
def countdown(n):
if n == 0:
print('Blastoff!')
else:
print(n)
countdown(n - 1)
countdown(5)
OUTPUT:
5
4
3
2
1
this is end
def countdown(n):
- print('Entering countdown(',n,')')
- if n == 0:
- print('Blastoff!')
- else:
- print(n)
- countdown(n - 1)
- print('Exiting from countdown(',n,')')
- limit = int(input()) countdown(limit)