【发布时间】:2020-12-13 12:22:38
【问题描述】:
我想在python中计算(π/4)^2-sin(π/4):
import math
a=((math.pi)^2/16)-math.sin(math.pi/4)
print(a)
它给出了错误:
TypeError: unsupported operand type(s) for ^: 'float' and 'float'
我也尝试过使用
a=float(((math.pi)^2/16)-math.sin(math.pi/4))
还是不行
【问题讨论】:
-
哦。也许我应该使用 ** 而不是 ^
标签: python-3.x