pythonmathpow

Python - 0**0 == 1?


I was playing around with ** operator, and noticed that:

0**0 == 1

And

pow(0, 0) == 1

And even math:

math.pow(0, 0) == 1

And Google! (search for 0**0)

Why is it so? As far as I know 0**0 is undefined


Solution

  • No, you are mistaken. It works as it should.

    n/0 is undefined. 0**0 however is 1 because any number raised to the power of 0 is 1.

    Here are some references:

    Link

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