Collections

Python gives you four primary built-in collection data types, each designed for a different purpose.


List

Ordered
Mutable
Allows duplicates
Indexable
Most commonly used general-purpose container

[1, 2, 3] 


Tuple

Ordered
Immutable
Allows duplicates
Often used for fixed-structure dat

(1, 2, 3) 


Set

Unordered
Mutable
No duplicates
Great for membership tests and deduplication

{1, 2, 3} 


Dictionary

Unordered (insertion-ordered since Python 3.7)
Mutable
Key-value pairs
Keys must be hashable

{"a": 1, "b": 2} 


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopNext