Home »
Python »
Python programs
Python program to find power of a number using exponential operator
Python exponential operator example: Here, we are going to learn how to find power of a number using exponential operator using exponential (**) operator in Python?
Submitted by IncludeHelp, on April 12, 2019
Given two numbers a and b, we have to find a to the power b using exponential operator (**).
Example:
Input:
a = 10
b = 3
# calculating power using exponential oprator (**)
result = a**b
print(result)
Output:
1000
Finding power of integer values
# python program to find the power of a number
a = 10
b = 3
# calculating power using exponential oprator (**)
result = a**b
print (a, " to the power of ", b, " is = ", result)
Output
10 to the power of 3 is = 1000
Finding power of float values
# python program to find the power of a number
a = 10.23
b = 3.2
# calculating power using exponential oprator (**)
result = a**b
print (a, " to the power of ", b, " is = ", result)
Output
10.23 to the power of 3.2 is = 1704.5197114724524
TOP Interview Coding Problems/Challenges