0
False or True or False
Hello, I tried these following statements: print(False == False or True) # Result is True print(False == True or False) # Result is False ??? print(False == True or False or True) # Result is True ?? Why turns the 3rd Result to "True" when I add another ".. or True"? How can these statements make any sense at all and what could they used for? "==" is higher than "or", so what ist this "or" for?
3 Antworten
+ 4
is like having (a) or (b) or (c) so either if a, b,c or more than one of these is true the result would be true, if it was (a) and (b) and (c) a,b and c must be true for the result to be true
+ 4
Condition1 OR condition2 is True if at least one condition is True.
Condition1 AND condition2 is True if all conditions are True; so, if at least one condition is False, the result is False: the contrary of OR.
+ 3
the second one: False ==True? No or False? No, so non of the options are true so it's false
Third one: same but or True? Yes, because or means if one of the terms in the expression is true (or more) the result is true