Boolean Operations

Python provides operators to combine the values using the standard concepts of "and", "or", and "not". These operators are expressed using the words and…

and, or, not
Python provides operators to combine the values using the standard concepts of "and", "or", and "not". These operators are expressed using the words and, or, and not.
XYX or Y
TrueTrueTrue
TrueFalseTrue
FalseTrueTrue
FalseFalseFalse
XYX and Y
TrueTrueTrue
TrueFalseFalse
FalseTrueFalse
FalseFalseFalse
Xnot X
TrueFalse
FalseTrue
Reading the tables the short way: and is True only when BOTH sides are True. or is False only when BOTH sides are False. not flips the value.