Program to find the value of one number raised to the power of another in python
In this python programming guide, we are going to learn to

write a program to find the value of one number raised to the power of another in python
Program to find the value of one number raised to the power of another in python
The python program to find the value of one number raised to the power of another is as follows:
# Owner : TutorialsInhand Author : Devjeet Roy
y = float(input("Enter a base: "))
x = int(input("Enter a exponent: "))
prod = 1
for i in range(x):
prod *= y
print("The value is:", prod)
The output of python program to find the value of one number raised to the power of another is as follows:
PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter a base: 4
Enter a exponent: 3
The value is: 64.0
Few important tips about this program
1. Firstly, we ask the user to enter a number for base and another number for exponent. Then we run the loop exponent times and multiply the base with itself such that we get the required value.
2. For e.g. : 2^{3 }= 2 x 2 x 2. This is what we have done here. x^{y }means x multiplied by itself (y1) times.
3. This thing can also be done very easily by "**" operator.
Write a program to find the value of one number raised to the power of another in python snapshot:
Would you like to see your article here on tutorialsinhand.
Join
Write4Us program by tutorialsinhand.com
About the Author
Devjeet Roy
Full Stack Web Developer & Data Science Enthusiast
Page Views :
Published Date :
Mar 17,2021