Summary
In this lab, we covered several major important topics. Let’s quickly review them.
Booleans in Pseudocode
true
false
BOOLEAN()
procedure to convert values- 0 is
false
, and any other number istrue
- 0 is
Pseudocode Boolean Operators
AND
OR
NOT
Pseudocode Boolean Comparators
=
equal!=
not equal<
less than<=
less than or equal to>
greater than>=
greater than or equal to
Booleans in Python
True
False
bool()
procedure to convert values- If the input is the value
False
, the value0
, the valueNone
, or anything with 0 length, including the empty string, it will returnFalse
. - Otherwise, for all other values it will return
True
.
- If the input is the value
Python Boolean Operators
and
or
not
Python Boolean Comparators
==
equal!=
not equal<
less than<=
less than or equal to>
greater than>=
greater than or equal to
Comparators and Strings
Strings are compared using lexicographic order
Boolean Order of Operations
- Math operators (following their order of operations)
- Boolean comparators
not
and
or