Variables of type Boolean (named after George Boole) can have only two values: True
and False
.
For example, b1 = True
makes b1
a variable of type Boolean with value True
.
Note that this is not the same as b1 = "True"
, which would make b1
a variable of type string with text data "True
".
True
and False
are keywords recognized by Python as Boolean values, the string "True"
is not.
Importantly, Booleans are made using equalities and inequalities.
a == 5
evaluates to True
if variable a
has value 5, and to False
otherwise.
a != 5
evaluates to True
if variable a
does not have value 5, and to False
if it does.
The inequalities <
, <=
, >
, and >=
can also be used to compare values.