The three Boolean operators are:

  • and
  • or
  • not

These are used to compare Boolean values.

Binary Boolean Operators#

The and and or operators always take two Boolean values so they're considered binary operators.

The and Operator's Truth Table

Expression Evaluates to ...
True and False False
False and True False
False and False False

The or Operator's Truth Table

Expression Evaluates to ...
True or True True
True or False True
False or True True
False or False False

Unary Boolean Operator#

Operates on only one Boolean value which makes it unary.

The not Operator's Truth Table

Expression Evaluates to ...
not True False
not False True

Mixing Boolean and Comparison Operators#

Because comparison operators evaluate to Boolean values, you can use them in expressions with the Boolean operators.

>>>(4 < 5) and (5 < 6)
True