Can anyone please explain this to me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone please explain this to me?

print(False == (False or True)) Output: False

17th Oct 2020, 5:43 PM
OTAKU NO.1
OTAKU NO.1 - avatar
16 Answers
+ 4
false or true give you true true is not equal to false so false == true gives false and that will be print
19th Oct 2020, 12:41 PM
Khushi Patel
Khushi Patel - avatar
+ 6
False == (False or True) (False or True) -> True False == True -> False
17th Oct 2020, 6:00 PM
Bagon
Bagon - avatar
+ 2
This is known as precedence of operators. Brackets first. False or True gives True False== True gives False
19th Oct 2020, 4:51 PM
Kirabo Ibrahim
Kirabo Ibrahim - avatar
+ 1
Yes sir
17th Oct 2020, 5:58 PM
OTAKU NO.1
OTAKU NO.1 - avatar
+ 1
Thank you scorpion sir
17th Oct 2020, 6:44 PM
OTAKU NO.1
OTAKU NO.1 - avatar
+ 1
ABHIRAJ SRIVASTAVA you are welcome
17th Oct 2020, 6:45 PM
</𝚜𝚌𝚘𝚛𝚙𝚒𝚘𝚗>
</𝚜𝚌𝚘𝚛𝚙𝚒𝚘𝚗> - avatar
+ 1
The or operator returns True if at least one of the expressions is True otherwise it returns False. I think it is better you understand it rather than just memorizing the truth table
19th Oct 2020, 10:45 AM
L. Davi
L. Davi - avatar
17th Oct 2020, 5:53 PM
</𝚜𝚌𝚘𝚛𝚙𝚒𝚘𝚗>
</𝚜𝚌𝚘𝚛𝚙𝚒𝚘𝚗> - avatar
0
Sir From this only i asked this qusetion .......
17th Oct 2020, 5:54 PM
OTAKU NO.1
OTAKU NO.1 - avatar
0
Ok False or true \\ true False == true \\ false Do you understand
17th Oct 2020, 5:55 PM
</𝚜𝚌𝚘𝚛𝚙𝚒𝚘𝚗>
</𝚜𝚌𝚘𝚛𝚙𝚒𝚘𝚗> - avatar
0
I am just having problem with this True or False ....... while printing
17th Oct 2020, 6:00 PM
OTAKU NO.1
OTAKU NO.1 - avatar
0
Bagon sir can you explain me how (False or True ) Gives true?
17th Oct 2020, 6:02 PM
OTAKU NO.1
OTAKU NO.1 - avatar
0
ABHIRAJ SRIVASTAVA now you have to learn that lesson
17th Oct 2020, 6:03 PM
</𝚜𝚌𝚘𝚛𝚙𝚒𝚘𝚗>
</𝚜𝚌𝚘𝚛𝚙𝚒𝚘𝚗> - avatar
0
But how , i am not understanding this one , when i was going ahead it was easy for me to do practice and module questions sir . But i want to understand this.......
17th Oct 2020, 6:06 PM
OTAKU NO.1
OTAKU NO.1 - avatar
17th Oct 2020, 6:08 PM
</𝚜𝚌𝚘𝚛𝚙𝚒𝚘𝚗>
</𝚜𝚌𝚘𝚛𝚙𝚒𝚘𝚗> - avatar
0
ok I have a good view. take a balance , think it as OR balance. Now if you have truth in any of its arm, it will show you are telling truth. If you have false on both sides, of course you are telling false. Hence in your case, there was truth somewhere, hence result is true.
19th Oct 2020, 2:34 PM
Daniel Kazmarek
Daniel Kazmarek - avatar