Step: Dictionaries: iterate items()

Dictionaries: iterate items()

dict.items() yields (key, value) pairs you can unpack directly in a for loop.

Why it matters: it's the standard way to walk a whole dictionary — looping over .keys() and re-looking-up values is slower and more verbose.

Example: for k, v in {"a": 1}.items(): print(k, v) prints a 1.

Your turn: print each name and score on its own line by iterating scores.items().

Pitfall: since Python 3.7 dicts preserve insertion order, so this loop is deterministic — but don't rely on sorted order unless you sort explicitly.

Setup:
scores = {"alice": 92, "bob": 81, "cara": 88}
Your code:
Expected output:
alice 92
bob 81
cara 88
Step 8 of 18