Track 3 · Lesson 6 of 11
Truthy and falsy values
Use any value as a condition, know which values count as false, and decide when an explicit comparison is safer.
You will be able to
- List the common falsy values: False, 0, 0.0, an empty string and None
- Use a string or number directly as a condition, as in if name:
- Explain why if value: treats a real 0 as missing
- Choose between a truthiness check and an explicit comparison
Included with a Formula Quest membership
It has 3 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.