Read the code. Carefully.
Every module opens with one small, focused snippet. No filler files, no project scaffolding — just the idea, distilled to the fewest lines that can teach it.
def tally(items): counts = {} for x in items: counts[x] = counts.get(x, 0) + 1 return counts tally(["a", "b", "a"])
Default lookup
counts.get(x, 0) returns 0 when x isn't in the dict yet — no KeyError.
Return shape
Returns a dict of str → int. Before scrolling, can you name the keys it'll contain?