Python Data Structures
Lists, tuples, dictionaries and sets — and comprehensions to build them concisely.
Beginner
Python's built-in collections cover most needs:
| Type | Ordered | Mutable | Duplicates | Example |
|---|---|---|---|---|
list | yes | yes | yes | [1, 2, 2] |
tuple | yes | no | yes | (3.3, 5.0) |
dict | yes (insertion) | yes | keys unique | {"R1": 220} |
set | no | yes | no | {"GND", "VCC"} |
Sub-topics (5)
Lists
Ordered, mutable sequences — the workhorse collection in Python.
Beginner♥ 0🔖 0💬 0
Tuples
Immutable ordered sequences — great for fixed records and returning several values.
Beginner♥ 0🔖 0💬 0
Dictionaries
Key–value maps with fast lookup — ideal for configurations, counters and JSON data.
Beginner♥ 0🔖 0💬 0
Sets
Unordered collections of unique items with fast membership tests and set algebra.
Beginner♥ 0🔖 0💬 0
List Comprehensions
A compact way to build lists (and dicts and sets) from other iterables.
Easy♥ 0🔖 0💬 0
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.