- Strings
str, integers int, floats float, booleans bool - Dynamic typing — no need to declare types
- Type conversion:
int(), float(), str() - Naming conventions: lowercase with underscores
- Ordered, mutable collections:
[1, 2, 3] - Zero-based indexing and negative indexing
- Slicing:
list[1:4] to extract subsets - Methods:
append, extend, sort, len
- Key-value pairs:
{"name": "Alice", "sales": 5000} - Fast lookup by key; keys must be unique
- Nested dicts for structured records
- Methods:
.keys(), .values(), .items()
if / elif / else for conditional logicfor loops to iterate over lists and dicts- List comprehensions:
[x*2 for x in data] - Boolean operators:
and, or, not
- Define with
def, return values with return - Parameters and default argument values
- Scope: local vs. global variables
- Reusable code blocks for data transformations
- Create lists and dictionaries for sales data
- Write loops to compute totals and averages
- Define functions to clean and transform data
- Use comprehensions to filter and reshape datasets