+ 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

11th Sep 2019, 6:12 AM
Mostapha Amenchar
Mostapha Amenchar - avatar
5 Respostas
+ 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
11th Sep 2019, 8:54 AM
Lothar
Lothar - avatar
+ 3
0**0 is undefined so it returns 1.
11th Sep 2019, 12:29 PM
Manoj
Manoj - avatar
11th Sep 2019, 6:39 AM
Bilbo Baggins
Bilbo Baggins - avatar