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.
7 Respostas
+ 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
+ 2
False is convertible to 0.
Whatever int ** 0 == 1.
+ 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.
+ 1
The number is true, so it is 2**0, in math 0 degree of the number is 1
+ 1
I think, i got it now... thanks to all...
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
0
No it's 1 in math too