+ 2
NECESITO AYUDA! Por favor!!!
Porque pasa esto?? No debería ser falsa la condición?? if 1 or 2 == 0: print("Hola!") else: print("Chau") Output: Hola
2 ответов
+ 1
I don't speak much Spanish so maybe you can translate this from English.
if 1 or 2 == 0
prints "Hola" because one of the two conditions are true.
It's evaluated like this: if 1 or (2 == 0).
Where the 1 becomes a boolean expression which is evaluated as true.
You can fix this by changing the condition to:
if (1 or 2) == 0:
print("Hola!")
else:
print("Chau")
+ 1
Thanks you!!!! I spent two hours thinking in the solution