Q.No.3 - Write a Python program to find the power of a number using recursion.

Sol.-

def po(a,b):
    if b==0:
        return 1
    else:
        return a*po(a,b-1)
print(po(5,3))




Explain :
Step 1: Here we create a function (po).
Step 2: Now if b=0 so the value return 1, otherwise it shift to else condtion.
Step 3: else condtion return a*po(a,b-1) in this recursion is use.
Step 4: It print the value after solve it.


OUTPUT:

125