类型错误:使用 math.ceil 时'float'对象不可调用



我在计数以下计数变量时遇到了上述错误。

EIRP_ant = [9296, 9296, 9296, 7868, 7868, 7868];
r_max = math.ceil((sum(EIRP_ant) / (4 * math.pi() * 0.1)) ** 0.5);

有人知道为什么出现此错误吗?

您获得

typeerror:'float'对象不是可呼叫

因为

math.pifloat不是函数

因此

import math
EIRP_ant = [9296, 9296, 9296, 7868, 7868, 7868]
print(math.ceil((sum(EIRP_ant) / (4 * math.pi * 0.1)) ** 0.5))

输出

203

当您获得X is not callable错误时,您必须寻找错误的位置()

math.pi是浮点,而不是函数。将math.pi()更改为math.pi

最新更新