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.
3/2/2020 9:11:45 PM
Gabor7 Answers
New Answer(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
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.
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
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message