Keywords — The 35 Reserved Words
Keywords are the words Python owns. They define the language itself — you cannot use them as variable names, no matter how clever the idea seems.
See them all yourself
Python can list its keywords for you:
import keyword
print(keyword.kwlist)
print(len(keyword.kwlist))Output (Python 3.12):
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
35Thirty-five words. That's the entire "vocabulary" Python reserves — English has hundreds of thousands. This smallness is a feature: you can learn every keyword in a week.
The proof they're reserved
Try to use one as a variable:
for = 5Output:
SyntaxError: invalid syntaxPython stops you instantly. Compare with a non-keyword:
for_you = 5 # fine — "for_you" is not the keyword "for"The keywords, grouped by what they do
Values: True, False, None
Decisions: if, elif, else
Loops: for, while, break, continue
Functions: def, return, lambda, yield, pass, global, nonlocal
Classes & objects: class, self-adjacent tools like del
Logic: and, or, not, in, is
Errors: try, except, finally, raise, assert
Imports: import, from, as
Contexts: with, async, await
You already know some from Module 1. The rest arrive naturally, one per lesson — by the end of this course you'll have used almost all 35 without ever sitting down to "memorize keywords."
The three special-value keywords (meet them now)
True, False, and None appear constantly:
is_student = True
is_teacher = False
result = None # "nothing yet" — an empty placeholderNone deserves special attention: it means "no value here", and it's what functions return when they don't return anything:
def say_hi():
print("hi")
x = say_hi()
print(x) # None — say_hi displays text but returns nothingCommon Errors & Fixes
class = "10th", for = 5).True, not true. Same for False and None. This one catches *everyone* coming from other languages.✅ Checkpoint
import keyword; print(keyword.kwlist))*import = 5 or importing = 5? *(importing — "importing" is not the keyword "import")*None mean? *(No value — an intentional empty placeholder)*true or True? *(True — keywords are case-sensitive)*Next: identifiers — the names *you* get to invent, and the rules that govern them.