Python – 0**0 == 1?

Question:

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

Asked By: JadedTuna

||

Answers:

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

Answered By: user2555451

Anything to the power 0, by definition, is 1.

Answered By: Daniel Roseman

Because of the math rules. Everything in a 0-th power is 1.

Answered By: om-nom-nom
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.