programming-examples/python/Function/Python program to calculate the value of 'a' to the power 'b'.py

11 lines
199 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
def power(a,b):
if b==0:
return 1
elif a==0:
return 0
elif b==1:
return a
else:
return a*power(a,b-1)
print(power(3,4))