Lesson 5 of 7
A list of dictionaries
A whole playlist = a list of dictionaries. It's THE data shape you'll meet everywhere (APIs, databases…).
To find the hit, walk the list keeping the best one seen so far — the "champion pattern" applied to dicts.
for t in tracks:
if t["plays"] > best["plays"]:
best = t🎯 Your goal
With the given playlist, find the most-played track: store its full dictionary in best, then print best["title"].
PRO lesson
This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.
Discover PRO →