Search code examples
pythonlogical-operators

Can someone explain why print("red" == "blue" or 3 >= 3) returns True


I cant figure this out in my head.

>>>print("red" == "blue")
False

>>>print("red" == 3 >= 3)
False 

so why is the following True?

>>> print("red" == "blue" or 3 >= 3)
True

someone put my brain out of its misery


Solution

  • When you use the Boolean Operator or, only one of the conditions declared has to be true in order for it to return true. 3>=3 is true, so the whole expression is true.