Start hereList, tuple, set or dictionary—what changes when you choose the wrong one?
Collections encode assumptions about order, uniqueness, mutability and lookup. The right data structure makes intended operations obvious and accidental complexity harder.
Building interactive view…
Technical lensFormalise what the visual is doing
Lists provide ordered mutable sequences; tuples are ordered and immutable; sets optimise uniqueness/membership; dictionaries map keys to values with fast key-based lookup.
Technical questionUse a tiny case to make the mechanism observable. Lists provide ordered mutable sequences; tuples are ordered and immutable; sets optimise uniqueness/membership; dictionaries map keys to values with fast key-based lookup. Verify one intermediate quantity, state change or mapping independently; then predict the consequence of this change: Replace a dictionary lookup with repeated list scanning and compare the mental and computational cost.
Practitioner lensUse it responsibly
Choose by operations, not habit. If identity matters, use keys; if uniqueness matters, use sets; if order and repetition matter, use sequences.
Transfer testUsing a list for repeated membership tests when a set is more appropriate.
Worked explorationUse the visual as an experiment, not decoration
Store the same five values in a list, set and dictionary. Observe that the list preserves order and duplicates, the set removes duplicates and supports membership, and the dictionary retrieves values by key.
Technical lens
Lists provide ordered mutable sequences; tuples are ordered and immutable; sets optimise uniqueness/membership; dictionaries map keys to values with fast key-based lookup.
Practitioner check
Choose by operations, not habit. If identity matters, use keys; if uniqueness matters, use sets; if order and repetition matter, use sequences.
Prediction before interactionReplace a dictionary lookup with repeated list scanning and compare the mental and computational cost.
Exploration walkthroughTurn the interaction into an evidence trail
Store the same five values in a list, set and dictionary. Observe that the list preserves order and duplicates, the set removes duplicates and supports membership, and the dictionary retrieves values by key. Before moving the control, state your prediction. After the visual changes, name the specific state, statistic, boundary or mapping that changed and explain why that change is consistent—or inconsistent—with your prediction.
- Record one observable quantity before the interaction and the same quantity afterwards.
- Change one factor at a time so the causal effect of the control is inspectable.
- Use an edge or failure case to discover where the concept stops behaving as the simple story suggests.