Day 33 of 100 Days of Python
Practising Recursion
1
2
3
4
5
6
7
8
9
# Recursion exponent
def power(base, exp):
if exp ==0:
return 1
return base * power(base, exp-1)
r = power(2,5)
print(r)
This post is licensed under CC BY 4.0 by the author.