Program:
Hello Students this program is very useful for O Level Practical so read it carefully.
def power(x,y):
if y==0:
return 1
else:
return x * power(x, y-1)
x = float(input("Enter a value of base: "))
y = int(input("Enter value of exponent: "))
result = power(x, y)
print(result)
Output:
Enter a value of base: 2
Enter value of exponent: 3
8.0
Comments