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:
Your code:Expected output:
Step 8 of 18