Skip to main content
Loading page…
Python Mastery
Chapter 4
Lesson 2 of 5
Tuples & Immutability
Contents
Notes
Tutor
Concept
Tuples — Immutable Sequences
Loading activity…
Previous
1 / 6
Continue
Contents
Notes
Discussion
Tutor
18 min
6 activities
0 of 6 done
In this lesson
1
Tuples — Immutable Sequences
2
Packing, Unpacking & the Swap Idiom
3
Named Tuples — Tuples with Labels
4
Single-Element Tuple Syntax
5
When to Prefer a Tuple Over a List
6
Unpacking Practice
Objectives
Create and index tuples, and understand why they are immutable
Use tuple packing and unpacking including the swap idiom
Return multiple values from a function using tuples
Decide when to prefer a tuple over a list
Chapter 4 · Lists, Tuples, Sets & Dictionaries
Lists: The Workhorse
Tuples & Immutability
Dictionaries: Key–Value Power
Sets & Set Operations
Choosing the Right Container
Previous: Lists: The Workhorse
Next: Dictionaries: Key–Value Power