0

Why is False**False = 1?

Hi everyone... i ran into this : >>> 2**(1=="1") In a challenge... and the answer was : 1 I dont really get it why false ** false is 1!!?? Can anyone please explain!? Thank you.

2nd Mar 2020, 9:11 PM
Gabor
Gabor - avatar
7 Antworten
+ 7
(n^y) /(n^y) = (n/n) ^(y-y) => (n/n)^(0)=> 1, at school in math we learn that if n=0, 0^0 is indefined
2nd Mar 2020, 10:35 PM
Helena Vargas
Helena Vargas - avatar
+ 2
False is convertible to 0. Whatever int ** 0 == 1.
2nd Mar 2020, 9:21 PM
HonFu
HonFu - avatar
+ 1
Long story here: https://en.m.wikipedia.org/wiki/Zero_to_the_power_of_zero tl,dr: One of these things in maths we just agree upon - or not. 😉 Anyway: Python follows this rule, so that's how that challenge gets to its result.
2nd Mar 2020, 10:18 PM
HonFu
HonFu - avatar
+ 1
The number is true, so it is 2**0, in math 0 degree of the number is 1
3rd Mar 2020, 5:55 PM
Davit Arakelyan
Davit Arakelyan - avatar
+ 1
I think, i got it now... thanks to all...
3rd Mar 2020, 6:05 PM
Gabor
Gabor - avatar
0
Okay... thats true in math with any numbers except 0, but i still dont get it why 0**0 = 1 in python... in math 0**0 = 0
2nd Mar 2020, 9:35 PM
Gabor
Gabor - avatar
0
No it's 1 in math too
2nd Mar 2020, 10:15 PM
Qasem