Editorial Staff - - Python Programming
Today we are going to share a Python program to find the power of a number. If you are a python beginner and want to start learning the python programming, then keep your close attention in this tutorial as I am going to share a Python program to find the power of a number.
1 2 3 4 5 6 7 8 | def power(base,exp): if(exp==1): return(base) if(exp!=1): return(base*power(base,exp-1)) base=int(input("Enter base: ")) exp=int(input("Enter exponential value: ")) print("Result:",power(base,exp)) |
Enter base: 5
Enter exponential value: 3
Result: 125
Liked this program? Do Like & share with your friends.
Editorial Staff at FreeWebMentor is a team of professional developers leads by Prem Tiwari View all posts by Editorial Staff