Python cheatsheet

Syntax snippets and quick notes for revision.

Python Introduction

items = ["Python Introduction", "practice", "review"]
for position, item in enumerate(items, start=1):
    print(f"{position}. {item}")

Use this python introduction pattern when a Python task needs a small, readable starting point.

Syntax and Indentation

items = ["Syntax and Indentation", "practice", "review"]
for position, item in enumerate(items, start=1):
    print(f"{position}. {item}")

Use this syntax and indentation pattern when a Python task needs a small, readable starting point.

Variables

items = ["Variables", "practice", "review"]
for position, item in enumerate(items, start=1):
    print(f"{position}. {item}")

Use this variables pattern when a Python task needs a small, readable starting point.

Data Types

items = ["Data Types", "practice", "review"]
for position, item in enumerate(items, start=1):
    print(f"{position}. {item}")

Use this data types pattern when a Python task needs a small, readable starting point.

Numbers and Math

items = ["Numbers and Math", "practice", "review"]
for position, item in enumerate(items, start=1):
    print(f"{position}. {item}")

Use this numbers and math pattern when a Python task needs a small, readable starting point.

Strings

items = ["Strings", "practice", "review"]
for position, item in enumerate(items, start=1):
    print(f"{position}. {item}")

Use this strings pattern when a Python task needs a small, readable starting point.

String Formatting

items = ["String Formatting", "practice", "review"]
for position, item in enumerate(items, start=1):
    print(f"{position}. {item}")

Use this string formatting pattern when a Python task needs a small, readable starting point.

Lists

items = ["Lists", "practice", "review"]
for position, item in enumerate(items, start=1):
    print(f"{position}. {item}")

Use this lists pattern when a Python task needs a small, readable starting point.

List Comprehensions

items = ["List Comprehensions", "practice", "review"]
for position, item in enumerate(items, start=1):
    print(f"{position}. {item}")

Use this list comprehensions pattern when a Python task needs a small, readable starting point.

Tuples

items = ["Tuples", "practice", "review"]
for position, item in enumerate(items, start=1):
    print(f"{position}. {item}")

Use this tuples pattern when a Python task needs a small, readable starting point.

Sets

items = ["Sets", "practice", "review"]
for position, item in enumerate(items, start=1):
    print(f"{position}. {item}")

Use this sets pattern when a Python task needs a small, readable starting point.

Dictionaries

items = ["Dictionaries", "practice", "review"]
for position, item in enumerate(items, start=1):
    print(f"{position}. {item}")

Use this dictionaries pattern when a Python task needs a small, readable starting point.