List[1, 2, 3]: ordered, changeable, allows duplicates. The everyday choice for a sequence of items.
Tuple(1, 2, 3): ordered but cannot be changed after creation. Good for fixed records such as coordinates, and can be used as a dictionary key.
Set{1, 2, 3}: unordered, no duplicates, very fast membership checks (x in s). Great for removing duplicates and for union and intersection.
Dictionary{"name": "Asha", "age": 25}: maps keys to values. Lookup by key is fast.
Quick guide: need order and changes, use a list. Need uniqueness, use a set. Need to look something up by a name or id, use a dict. Need a fixed bundle of values, use a tuple.
In modern Python (3.7+), dictionaries keep the order in which keys were inserted.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
[1, 2, 3]: ordered, changeable, allows duplicates. The everyday choice for a sequence of items.(1, 2, 3): ordered but cannot be changed after creation. Good for fixed records such as coordinates, and can be used as a dictionary key.{1, 2, 3}: unordered, no duplicates, very fast membership checks (x in s). Great for removing duplicates and for union and intersection.{"name": "Asha", "age": 25}: maps keys to values. Lookup by key is fast.Quick guide: need order and changes, use a list. Need uniqueness, use a set. Need to look something up by a name or id, use a dict. Need a fixed bundle of values, use a tuple.
In modern Python (3.7+), dictionaries keep the order in which keys were inserted.