Loading...

Boolean

A type with two values, True and False, used for conditions and flags.

When to use: Conditional branching and boolean-mask filtering.

Example: bool([]) is False; bool([0]) is True (non-empty). sum([True, True, False]) == 2.

More Python for ML Glossary terms