Skip to content
UPEEC

Python Data Structures

Lists, tuples, dictionaries and sets — and comprehensions to build them concisely.

Beginner
Comments 0

Python's built-in collections cover most needs:

TypeOrderedMutableDuplicatesExample
listyesyesyes[1, 2, 2]
tupleyesnoyes(3.3, 5.0)
dictyes (insertion)yeskeys unique{"R1": 220}
setnoyesno{"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.