Booleans
Values
Reference: https://docs.python.org/3/library/stdtypes.html#boolean-values.
In Python, True
and False
are reserved words which indicate boolean values.
Operations
Reference:
It is common to evaluate the combination of multiple boolean conditions. The keywords and
and or
are reserved for this purpose. The and
operator will return True
only if all values are True
, whereas the or
operator will return True
if any of the values are True
:
The most relevant boolean operator is the equality operator, ==
. Its functionality is represented by the phrase, "Is this equal to that?":
The inverse is the inequality operator, !=
. Its functionality is represented by the phrase, "Is this not equal to that?":
Last updated