Python - 0 ** 0 == 1?

时间:2013-11-17 15:41:49

标签: python math pow

我正在玩**运算符,并注意到:

0**0 == 1

pow(0, 0) == 1

甚至math

math.pow(0, 0) == 1

Google ! (搜索0**0

为什么会这样?据我所知,0 ** 0未定义

3 个答案:

答案 0 :(得分:5)

不,你错了。它可以正常工作。

n/0未定义。 0**0 10,因为1提升的任何数字都是{{1}}。

以下是一些参考资料:

http://mathforum.org/dr.math/faq/faq.number.to.0power.html

https://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_power_of_zero

答案 1 :(得分:0)

根据定义,对功率0的任何内容都是1。

答案 2 :(得分:0)

由于数学规则。 0次方的所有东西都是1。