Booleans

from Exercism

There are two Boolean values: True and False. They can be assigned to a variable and combined with Boolean operators (and, or, not):

true_variable = True and True
false_variable = True and False

true_variable = False or True
false_variable = False or False

true_variable = not False
false_variable = not True

The expression on the right hand side is only evaluated if needed. This is short circuit evaluation.

Not is evaluated before and and or. BEDMAS can be used here.

>>>not True and True
False

>>>not (True and False)
True

bool() converts any object to a Boolean value. All objects return True unless defined to return False.

Built-ins that are always considered false: