+ 6
False or False
Why are the first two statements false?🤷 I used to think if something is not true, it'd be false😃😃 https://code.sololearn.com/c52tLoxCAchP/?ref=app
5 Respuestas
+ 3
Amazing Ozair Khan just provided a logic that works
We all know that False and any other thing is False
print((5>7)&(7==False))
print((5>7)&(7==True))
+ 5
Research about "chaining comparisons in python" using your favorite search engine.
+ 3
Coder's Crux if we use the logic you just provided,
5 > 7 == False or
5 > 7 == 0 or
0 == 0
Should be True. Yes?
+ 2
https://code.sololearn.com/cyU405Sr6hae/?ref=app
I have made an edit of the code that shows that the logic is the same, and 5 > 7 == False is true.
I can only presume that the print statement has had an issue with using two boolean checks in it, or has its' priority wrong.
Maybe the use of parentheses is the answer in this one.
0
I presume it is because of pythons relation of False == 0 & True == 1.
I'm not very good with that stuff, but it makes sense that the False can be replaced with 0 in those checks and that might give you more ideas.
i.e.
5 > 7 == True or
5 > 7 == 1 or
0 == 1
Which'll give you and nice little False statement.