One page
Python cheat sheet
What to keep at hand. If a line is not clear, go back to the matching lesson in the course.
Open the course: Python: getting startedSyntax
| What | How |
|---|---|
| Block | a colon + an indent |
| Empty | None |
| String | f"n={n}" |
| Comment | # |
Data and functions
| What | How |
|---|---|
| List | ["tea", "coffee"] |
| Dict | {"id": 1} |
| Loop | for x in xs: |
| Function | def greet(name): |
| Class | class User: |
| File | with open(...) as f: |