python幂运算符
Given two numbers a and b, we have to find a to the power b using exponential operator (**).
给定两个数a和b,我们必须找到一个与电源b。使用指数运算符(**)。
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
翻译自: https://www.includehelp.com/python/find-power-of-a-number-using-exponential-operator.aspx
python幂运算符