Python Keywords & Built-ins
All 35 reserved keywords in Python 3 plus the most-used built-in functions — in one scannable reference. Drill these by typing real Python snippets.
All 35 Python Keywords
These words are reserved by the interpreter and cannot be used as identifiers.
| Keyword | Description |
|---|---|
False | Boolean false literal |
None | Null / absence of value |
True | Boolean true literal |
and | Logical AND operator |
as | Alias in import or with statements |
assert | Assertion / debug check |
async | Declare an async function or block |
await | Suspend execution of a coroutine |
break | Exit the nearest enclosing loop |
class | Define a new class |
continue | Skip to the next loop iteration |
def | Define a function |
del | Delete a variable or object attribute |
elif | Else-if branch in conditional |
else | Fallback branch in if / for / try |
except | Catch an exception |
finally | Always-run block after try/except |
for | Iterate over a sequence |
from | Import specific names from a module |
global | Declare a global variable inside a function |
if | Conditional execution |
import | Import a module |
in | Membership test / loop iteration |
is | Identity comparison (same object) |
lambda | Anonymous one-line function |
nonlocal | Refer to an enclosing scope variable |
not | Logical NOT operator |
or | Logical OR operator |
pass | No-op placeholder statement |
raise | Raise an exception |
return | Return a value from a function |
try | Begin an exception-handling block |
while | Conditional loop |
with | Context manager (auto cleanup) |
yield | Produce a value from a generator |
Essential Built-in Functions
These ship with every Python installation — no imports needed.
| Function | Purpose |
|---|---|
print() | Output to stdout |
len() | Length of a sequence |
range() | Generate a range of integers |
type() | Return the type of an object |
int() | Convert to integer |
str() | Convert to string |
float() | Convert to float |
list() | Create or convert to list |
dict() | Create or convert to dict |
set() | Create or convert to set |
tuple() | Create or convert to tuple |
bool() | Convert to boolean |
input() | Read from stdin |
open() | Open a file |
enumerate() | Iterate with index + value |
zip() | Pair elements from multiple iterables |
map() | Apply function to each element |
filter() | Keep elements where function is True |
sorted() | Return a sorted list |
reversed() | Return a reversed iterator |
sum() | Sum an iterable |
min() | Return the smallest value |
max() | Return the largest value |
abs() | Absolute value |
round() | Round a number |
isinstance() | Check type with inheritance |
hasattr() | Check if attribute exists |
getattr() | Get attribute by name |
setattr() | Set attribute by name |
repr() | Official string representation |
Practice typing these in CodeSpeedTest →
The fastest way to internalize Python syntax is to type real Python code — not read about it. Start with Hello World and work up to complex snippets.
Frequently asked questions
How many keywords does Python have?
Python 3.12 has 35 hard keywords (such as def, class, if, for, return, lambda, async, await) plus soft keywords like match, case and type.
How can I list Python keywords?
Run import keyword; print(keyword.kwlist). keyword.softkwlist lists the soft keywords.
Is print a keyword in Python 3?
No. print became a built-in function in Python 3; it was a statement only in Python 2.
Related language syntax references
- JavaScript Keywords ReferenceEvery JS keyword grouped by category — declarations, control flow, async, classes, modules, error handling. Includes TypeScript extras.
- SQL Commands ReferenceEssential SQL commands from SELECT to window functions, grouped by category. Practice SQL typing with real query snippets.
- HTML Tags ReferenceAll semantic HTML5 elements organized by category — document structure, text, forms, media, and interactive elements.
- CSS Properties ReferenceEssential CSS properties grouped by category — layout, flexbox, grid, typography, colors, animations, and modern CSS features.
- React Interview Typing PracticeCore React patterns — hooks, component composition, state management — as typing drills for technical interviews.
- Java Syntax DrillJava keywords, OOP patterns, and collections framework reference. Practice typing Java code from Hello World to design patterns.