+ 3
Is pow function well implemented?
pow(0,0) =1 I think it's wrong because 0^0 is undefinef https://code.sololearn.com/cJyPwTbsOYHQ/?ref=app
5 Réponses
+ 4
In python '^' is used as binary XOR operator: It copies the bit if it is set in one operand but not both.
This is not to calculate pow of a number:
>>> 2^2
0
>>> 2**2
4
>>> pow(2,2)
4
+ 3
0**0 is undefined so it returns 1.
0
https://stackoverflow.com/questions/14414430/why-0-0-equals-1-in-JUMP_LINK__&&__python__&&__JUMP_LINK
By the way, pow(0,0) is equivalent to 0**0