2024-04-25 14:58:25 发布
网友
为什么会产生错误?在
>>> from math import exp >>> exp**2 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for ** or pow(): 'builtin_function_or_method' and 'int'
exp**必须是exp或{}(在后一种情况下,from math import e)。math.exp不是常数e的名称,而是指数函数。在
exp**
exp
from math import e
math.exp
e
>>> exp(2) 7.38905609893065 >>> from math import e >>> e**2 7.3890560989306495
exp**
必须是exp
或{from math import e
)。math.exp
不是常数e
的名称,而是指数函数。在相关问题 更多 >
编程相关推荐