Tuples
Understand the benefits of immutable sequences and how to use them.
Tuples is a free Python Academy lesson on CoddyKit. This is lesson 2 of 5. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Python Academy learning path, and your progress syncs across the web and the CoddyKit app. The Python Academy course includes 5 lessons in total.
Introduction to Tuples
Tuples are immutable sequences in Python, meaning their elements cannot be changed after creation. They are often used to group related data.
In this lesson, you’ll learn how to create and use tuples, perform operations on them, and understand their immutability.

Creating Tuples
A tuple is created by placing elements inside parentheses (), separated by commas:
# Creating a tuple
fruits = ("apple", "banana", "cherry")
print(fruits)Accessing Tuple Elements
Like lists, you can access tuple elements using indexing:
# Accessing tuple elements
fruits = ("apple", "banana", "cherry")
print(fruits[1]) # Outputs: bananaImmutability of Tuples
Tuples are immutable, meaning their elements cannot be changed after creation:
# Immutability of tuples
fruits = ("apple", "banana", "cherry")
# Uncommenting the next line will raise an error
# fruits[1] = "grape"Tuple Operations
Tuples support operations like concatenation and repetition:
# Tuple operations
t1 = (1, 2, 3)
t2 = (4, 5)
print(t1 + t2) # Outputs: (1, 2, 3, 4, 5)
print(t1 * 2) # Outputs: (1, 2, 3, 1, 2, 3)Tuple Packing and Unpacking
You can pack multiple values into a tuple and unpack them into variables:
# Tuple packing and unpacking
t = (1, 2, 3)
a, b, c = t
print(a, b, c) # Outputs: 1 2 3Using Tuples as Keys
Tuples can be used as keys in dictionaries because they are immutable:
# Using tuples as dictionary keys
locations = {(40.7128, -74.0060): "New York", (34.0522, -118.2437): "Los Angeles"}
print(locations[(40.7128, -74.0060)]) # Outputs: New YorkCommon Mistakes with Tuples
Here are some mistakes to avoid:
- Trying to modify elements of a tuple (it’s immutable).
- Confusing tuples with lists due to similar syntax.
- Using mutable objects (like lists) inside tuples, as they can still be modified.
Lists Lesson Recap
What Did We Learn?
In this lesson, you learned:
- How to create and manipulate lists in Python.
- Common list operations and methods.
- How to use nested lists and iterate over lists.
Great job! Let’s move to the next topic.

Tuples Lesson Recap
What Did We Learn?
In this lesson, you learned:
- How to create and use tuples in Python.
- The immutability of tuples and its implications.
- How to use tuples in dictionary keys and other scenarios.
Great job! Let’s move to the next topic.

Learn Python with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 76
- Lessons
- 320
Frequently Asked Questions
Is the “Tuples” lesson free?
Yes — the full text of “Tuples” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Python Academy course, upgrade to CoddyKit PRO. The Python Academy course includes 5 lessons in total.
What will I learn in “Tuples”?
Understand the benefits of immutable sequences and how to use them. You practise Python Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Python Academy?
No prior experience is required. Python Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 2 of 5.
How long does the “Tuples” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Python Academy lesson?
Yes. Every Python Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.