7.1 Boolean Values and Boolean Expressions
- The Python type for storing true and false values is called
bool
- George Boole created Boolean Algebra, which is the basis of all modern computer arithmetic.
- There are only two boolean values
- Capitalization is important, since
true
and false
are not boolean values
- (remember Python is case sensitive).
- Boolean values are not strings!
boolean expression
- A boolean expression is an expression that evaluates to a boolean value.
- The equality operator,
==
, compares two values
- produces a boolean value (True or False) related to whether the two values are equal to one another.
Quick Note
- The
==
operator is one of six common comparison operators; the others are:
x != y # x is not equal to y
x > y # x is greater than y
x < y # x is less than y
x >= y # x is greater than or equal to y
x <= y # x is less than or equal to y
- Remember that
=
is an assignment operator and ==
is a comparison operator
- there is no such thing as
=<
or =>