Back
+10 XP
Concept

Truthy & Falsy

Every value in Python evaluates to `True` or `False`. Empty things (`0`, `""`, `None`) count as False; everything else is True.

python
print(bool(0))      # False
print(bool(""))     # False
print(bool("hey"))  # True

# 24. Truthy & Falsy Every value in Python secretly evaluates to `True` or `False`. These are empty and count as `False` (Falsy): - `0` and `0.0` - Empty text `""` - `None` and `False` Literally everything else counts as `True` (Truthy), even negative numbers (`-5`) and text containing a space (`" "`).

Checkpoint

What does an empty string `""` count as in a boolean check?

Practice

Test if `0` is True or False by converting it with `bool(0)` and printing it.

Terminal
01
Tap code blocks below to assemble
Available Blocks