September 13, 2026
Dictionary vs. List in Python: Choosing the Right Data Structure
Lists and dictionaries both store multiple values, but the way you look things up is fundamentally different — and picking the wrong one is a quiet cost, not a crash.
student_list = ["Ava", "Ben", "Cleo"]
print(student_list[1])
student_grades = {"Ava": 91, "Ben": 85, "Cleo": 97}
print(student_grades["Ben"])Ben 85
Lists: when order and position matter
Use a list when the data has a natural order and you access items by position — "the first one," "the last one," "the third item." student_list[1] only makes sense because you know Ben is specifically the second entry.
Dictionaries: when you look things up by name
Use a dictionary when you look up values by a meaningful key rather than a position. student_grades["Ben"] reads directly as "Ben's grade" — you don't need to know or care where Ben happens to sit in some ordering.
The performance difference
There's also a real performance difference: checking whether a key exists in a dictionary ("Ben" in student_grades) stays close to instant regardless of size, while checking whether a value exists in a list ("Ben" in student_list) gets slower as the list grows, since Python has to check items one by one until it finds a match or reaches the end.
See the Dictionaries and Lists lessons in our free Python course for more on both data structures.