Content · Programming · Python

Python bool Type: True and False Explained

The bool type represents truth values: True and False. These values are central to decisions and conditions. Learn the essential ideas and try a practical example.

2 views Published Oct 17, 2026 Updated Oct 18, 2026 Admin

The bool type represents truth values: True and False. These values are central to decisions and conditions.

Understanding the Concept


Boolean values arise from comparisons, membership checks, and logical expressions. You can also create them directly. When a program checks a condition, it uses truth-value testing to decide whether to follow a block. Python has rules for interpreting other objects as truthy or falsy; for example, zero and empty strings are falsy while most nonempty strings are truthy. The strings "True" and "False" are not Boolean values; they are text. Later lessons cover logical operators and truthiness in depth.

When and Why You Would Use This


Use a comparison to decide whether there is available capacity. The comparison result is a Boolean, not a message that prints automatically.

Practical Example


reserved_seats = 12
maximum_capacity = 20
seats_available = reserved_seats < maximum_capacity
print("Can accept another person:", seats_available)

Understanding the Example


Because 12 is less than 20, seats_available is True. The example separates a factual quantity from the decision derived from it.

Example Output


Can accept another person: True

Try It Yourself


Change reserved_seats to 20 and predict the printed Boolean before running the code.

Common Beginner Mistakes


  • Writing lowercase true or false as if they were Boolean literals in Python.
  • Using the strings "True" or "False" when a Boolean value is intended.
  • Assuming all nonzero and nonempty values are the same type as bool.

Key Takeaways


  • bool has two values: True and False.
  • Comparisons commonly produce Boolean results.
  • Truth-value testing drives conditional program behavior.
Share this resourceSend this page to someone who may find it useful.