Python quick reference
Python 3.12 essentials: values and types, control flow, functions, lists and dicts, strings, input and files — and how a Python program runs in Zerethon IDE.
Written for Python 3.12. Examples that show an output were run in the Zerethon sandbox (Python 3.12) on 2026-10-20.
Basics
-
Hello, World
The smallest Python program, and how
print()writes output. -
Variables and types
Names, numbers, strings, booleans,
None, and converting between types. -
Conditions and loops
if/elif/else,forover a range or a collection,while,breakandcontinue. -
Functions
Define functions with
def, default and keyword arguments, return values, and theif __name__ == "__main__"guard.
Data
-
Lists, dicts, sets and tuples
The four built-in collections, sorting, and list comprehensions.
-
Strings
f-strings, common string methods, splitting and joining, and regular expressions with
re.
Input and files
-
Reading input (stdin)
Read what you type in the IDE's Input tab with
input()orsys.stdin. -
Reading and writing files
Open project files with
open()andwith; write temporary files under/tmp. -
Modules and several files
Split a program into files and
importthem; what the standard library offers without installing anything.
In Zerethon IDE
-
Running Python in Zerethon IDE
What Run does with your project, the time limit, input, tests, and what a run cannot do.
-
Common errors
What
NameError,IndentationError,TypeError,IndexError,KeyErrorandEOFErrormean and how to fix them. -
Official documentation
Where to read more: the Python tutorial, the library reference and the language reference.