How to use this page
Each keyword below has:
- a short explanation,
- two (or more) minimal examples you can copy/paste,
- small notes about common mistakes.
Want to confirm keywords on your machine? Run:
python -c "import keyword; print(keyword.kwlist)"
All Python keywords (with 2+ examples each)
Scroll or search. Each card is a keyword.
Practice mini-project
Create a small program where you use at least 10 keywords: functions (def),
branching (if/elif/else),
loops (for/while),
error handling (try/except),
and a context manager (with).