What do the boolean operators and
, or
, and not
do in Python?
Instructor solution
and
: Returns True
if both statements are true. Examples: True and True
is True
, True and False
is False
.
or
: Returns True
if at least one statement is true. Examples: True or False
is True
, False or False
is False
.
not
: Returns the opposite of the result of the expression. Examples: not True
is False
, not False
is True
.
You may exit out of this review and return later without penalty.