Python| sympy.Pow() 方法
在sympy.Pow()方法的帮助下,我们可以找到a的b次幂,其中a和b是该方法的参数。
Syntax: Pow(a, b)
Parameter:
a – It denotes an integer.
b – It denotes an integer.
Returns: Returns an integer which is equal to a raised to the power of b, i. e., a^b.
示例 #1:
# import Pow() method from sympy
from sympy import Pow
a = 3
b = 3
# Use Pow() method
pow_a_b = Pow(a, b)
print("{}^{} = {}".format(a, b, pow_a_b))
输出:
3^3 = 27
示例 #2:
# import Pow() method from sympy
from sympy import Pow
a = 5
b = 4
# Use Pow() method
pow_a_b = Pow(a, b)
print("{}^{} = {}".format(a, b, pow_a_b))
输出:
5^4 = 625