INTRODUCTION
After learning storing single values in variables, We needed a way to hold collection of data i.e multiple ride counts
multiple cities etc.
Python offers four main data structures for this that is:
LISTS
A list is a built-in data type used to store multiple items in a single variable.
A list can be changed and allows addition of more items
It can also contain items of different data types
Lists also preserve and allows duplicate values

![]()

DICTIONARIES
A dictionary stores data in key-value.
This allows lookups by name instead of position
example;

Dictionaries are written in curly brackets {}
Each has a corresponding value
The keys should be unique
Dictionaries can be changed
SETS
A set stores only unique values any duplicates are automatically removed
They are written using curly brackets {}
You can add or remove items in a set
They are useful when keeping unique items
What I Learned
The most useful shift in understanding was realizing that choosing a data structure is really a design decision, not just a syntax choice. Picking a list when a dictionary is more appropriate (or vice versa) doesn't just look sloppy β it makes later code longer and harder to reason about. Matching the structure to what the data actually needs to do made every function I wrote afterward noticeably simpler.

Top comments (0)