Python literals

Module 2 · Python literals · Lesson 5 of 6

Boolean values

The boolean type — Python calls it bool — is the smallest of all: it has exactly two values, True and False. They answer every yes/no question your program asks.

Only two values
False
5 > 3True
2 == 5False
Booleans are what comparisons give back — the start of every decision your code makes.

Two details matter. They start with a capital letter — True, not true — and they're special words, not text, so they never take quotes. "True" with quotes is just a string.

You'll rarely type True or False by hand. Instead they appear as the result of comparisons like 5 > 3 — and those booleans are what let a program choose between two paths, which is where a later module picks up. First, a quick check on everything you've just met.