Python for Data Analytics • Lesson 8

Tuples

Learn how Python tuples store ordered collections of values, access items, unpack values and understand immutability.

Your progress0%

0 of 8 concepts completed

Complete the activity and related MCQ to unlock the next concept.

Concept 1TUPLE

What Is a Tuple?

A tuple is an ordered collection of values, written with parentheses ( ). Like a list, it keeps its order and can hold multiple values — but once created, its items cannot be changed.

Learn by Seeing

Parentheses hold an ordered set

student = ("Aman", 21, "Python")

print(student)
# ('Aman', 21, 'Python')

The order of the values is fixed, and the tuple itself is fixed.

A tuple holds multiple values in a fixed order. Edit the items:

your tuple

(0Aman1212Python)

Each item keeps its position. Adding an index to the visual makes it clear how the tuple is ordered.

Interactive Activity

How many values does the tuple student = ("Aman", 21, "Python") contain?

Hint: Count the comma-separated items inside the parentheses.

Python Analyst Mindset

Fixed records want fixed containers

When a value should never change — a date, a coordinate, a primary key, a fixed product record — a tuple tells Python (and your teammates) that the data is locked. Immutability is a safety feature, not a limitation.

01

Create

Wrap values in ( ).

02

Read

Index with [i] or [-1].

03

Unpack

One variable per item.

04

Trust

It cannot change underneath you.

Frequently Asked Questions

Tuples — FAQs

Why use a tuple instead of a list?

Tuples are immutable. Use them when the data should not change — like a record or a fixed set of coordinates.

Can a tuple contain a list inside it?

Yes. The tuple itself is fixed, but any mutable objects inside it can still be modified.

How do I change a tuple?

You do not — create a new tuple instead. Or convert to a list, change it, and convert back.

What happens if unpacking counts do not match?

Python raises a ValueError. The number of variables must equal the number of items in the tuple.

Lesson Summary

What you learned

Create with ( )

Tuples hold ordered values in one variable.

Indexing

Starts at 0; -1 refers to the last item.

Immutability

Items cannot be reassigned after creation.

len, count, index

Measure length, count occurrences, find positions.

Unpacking

Assign each item to its own variable in one line.

Tuple vs list

Use tuples for fixed records, lists for changeable data.