Question
Why are my boolean values not accepted?
Answer
Some common issues to keep in mind are:
Boolean values in Python do not have quotes around them. They are True
and False
, not true
, false
, ”True”
, or ”False”
, or any other combination.
Keep an eye out for <=
or >=
because the result will be True
if both sides are equal OR greater or lesser (depending on the symbol).
Let’s take a look at an example:
# Set this to True if 1000 != (20 + 22) or to False otherwise.
bool_googol =
The result stored in bool_googol
will be True
, because 1000 is definitely not equal to 42.