Boolean
A type with two values, True and False, used for conditions and flags.
- Truthy/falsy: empty containers and 0 are falsy.
- Subclass of int: True + True == 2.
- Drives mask filtering in NumPy/pandas.
When to use: Conditional branching and boolean-mask filtering.
Example: bool([]) is False; bool([0]) is True (non-empty). sum([True, True, False]) == 2.