-1

请向我解释它们之间的区别?

import math

print math.exp(2)

print

print 2 ** 3

==============================

7.38905609893

8
4

3 回答 3

3

您将 e 与 平方math.exp(2),e 是 2.71828183,请参见此处

使用2 ** 3,您将 2 提高到三次方。

于 2011-11-19T15:34:39.043 回答
3

您对math.exp():math.pow()感到困惑math.pow(2, 3) == float(2**3)

于 2011-11-19T15:46:51.203 回答
1

math.exp(2)e2 次方,22 ** 3次方 3 次方。

于 2011-11-19T15:35:17.153 回答