+ 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

15th Jul 2020, 6:55 AM
Tomiwa Joseph
Tomiwa Joseph - avatar
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))
15th Jul 2020, 7:33 AM
Tomiwa Joseph
Tomiwa Joseph - avatar
+ 5
Research about "chaining comparisons in python" using your favorite search engine.
15th Jul 2020, 7:35 AM
Kevin ★
+ 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?
15th Jul 2020, 7:14 AM
Tomiwa Joseph
Tomiwa Joseph - avatar
+ 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.
15th Jul 2020, 7:21 AM
coddy
coddy - avatar
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.
15th Jul 2020, 7:09 AM
coddy
coddy - avatar