Python: list vs dict (With Examples): Interview Answer Guide 2027
A Python list is an ordered, mutable sequence accessed by position — `items[0]` — while a dict is an unordered (insertion-ordered) key-value mapping accessed by key — `user['name']`. This python basics interview question is really about choosing well: lists for ordered collections and iteration, dicts for fast lookups by a unique key, with average O(1) access on both.
What the Python Basics Interview Question Tests
- Whether you know the core differences: ordered sequence vs. key-value mapping, index vs. key access.
- Whether you can justify a choice — 'I would use a dict here because lookups by id must be fast.'
- Whether you know the complexities: O(1) average access for both, O(n) search in a list.
How to Answer the Python Basics Interview Question
Concrete code beats abstract description:
- Example 1 — list. `scores = [88, 92, 75]`; `scores[0]` → 88; `scores.append(95)` grows it. Ordered, positional.
- Example 2 — dict. `users = {101: 'Ada', 102: 'Bo'}`; `users[101]` → 'Ada' in O(1) average. Keyed, fast.
- Example 3 — the wrong choice. Checking `if user_id in user_id_list` inside a loop is O(n) per check — with 10k users and 10k checks that is 100M operations. A dict or set makes each check O(1).
- Example 4 — comprehension. `{u['id']: u for u in users}` builds a lookup dict in one line.
Sample close: "The examples show the real skill: not syntax, but picking the structure whose access pattern matches the problem."
Common Mistakes With the Python Basics Interview Question
- Saying dicts are 'unordered' without nuance — since Python 3.7 they preserve insertion order, but you still must not rely on position.
- Using a list for membership tests in a loop: `x in my_list` is O(n) each time; a set or dict is O(1).
- Using mutable default arguments or dict keys that are mutable — dict keys must be hashable.
'List vs dict' sounds trivial, which is why it is a perfect filter: weak candidates recite syntax, strong candidates talk about access patterns and complexity. Always answer the 'when would you use each' follow-up before it is asked.
Keep Reading
- why investment banking bloomberg
- currency swap interview
- Bloomberg Behavioral Interview Questions & STAR Answers
- Bloomberg HireVue Tips 2027: How to Stand Out on Video
FAQ
When should I use a list vs a dict?
Use a list for ordered data you iterate or index by position. Use a dict when you look things up by a unique key, like user records by id.
What is the time complexity of lookup in each?
Indexing a list is O(1); searching a list by value is O(n). Dict lookup by key is O(1) on average thanks to hashing.
Can a dict have duplicate keys?
No — assigning to an existing key overwrites the value. If you need multiples, map each key to a list.
What is the difference between a dict and a set?
A set stores only unique keys with no values, optimized for membership tests and deduplication. A dict maps each key to a value.
Preparing for Bloomberg's interview? Our 2027 Bloomberg Plum Online Assessment & Video Interview Tutorials has practice questions and answers — $79 one-time, instant download.













































