在python中使用pow

时间:2015-09-10 21:35:39

标签: python pow

我对以下Python表达式感到困惑。变量term1Pin在调用之前计算:

term2 = pow(pow(Pin,2) - term1,0.5)

我理解pow(Pin,2) = Pin**2,但我不知道- term1, 0.5做了什么。

2 个答案:

答案 0 :(得分:2)

这是两个不同的电话。内部相等于removeObserver(self)(正如您所确定的),外部调用相当于Pin ** 2(Pin ** 2 - term1) ** 0.5(指数math.sqrt(Pin ** 2 - term1)幂等于取正方形一个数字的根。)

答案 1 :(得分:1)

编写表达式只是一种更简洁,更简洁的方法:

power_1 = pow(Pin, 2) 
power_1 = power_1 - term1 

term2 = pow(power1, 0.5)