Python Basics — Tuples

less than 1 minute read

Chapter 10 — Tuples

Tuples are Python’s immutable ordered sequences. They look like lists but cannot be changed after creation — making them perfect for fixed collections of data.

What You’ll Learn

Topic Page
Creating Tuples Creating Tuples →
Tuple Unpacking Tuple Unpacking →
Tuple Methods Tuple Methods →
Named Tuples Named Tuples →
Tuples vs Lists Tuples vs Lists →
Practice Exercises Practice Exercises →

Quick Preview

# Creating tuples
coordinates = (10, 20)
colors = ("red", "green", "blue")
single = (42,)  # trailing comma for single element

# Unpacking
x, y = coordinates
print(x, y)  # 10 20

# Immutable — cannot change
# colors[0] = "yellow"  # TypeError!

Mutable vs Immutable

Feature List Tuple
Syntax [1, 2, 3] (1, 2, 3)
Mutable Yes No
Can be dict key No Yes
Speed Slower Faster
Use case Dynamic data Fixed data

Start Learning: Creating Tuples →

Updated: