Why is print (false or true) always true? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is print (false or true) always true?

When I use integer values instead of boolean e.g. Print (4 or 5) it prints the first value. But the print (false or true) always prints the word true. Why?

25th May 2017, 11:53 AM
Marika Proch
2 Answers
+ 7
because in Boolean algebra “or“ is true if at least one part is true.
25th May 2017, 11:57 AM
Mario L.
Mario L. - avatar
+ 2
Boolean AND and or >>> print (False and True) False >>> print (False or True) True
27th May 2017, 8:36 PM
Janakiraman Munusamy
Janakiraman Munusamy - avatar