Track 6 · Lesson 4 of 12
Tuples and unpacking
Use tuples for fixed records that should not change, unpack them into names, and collect the rest with starred unpacking.
You will be able to
- Create tuples, including one-item and empty tuples, and explain how they differ from lists
- Unpack a tuple or list into separate variables, including in a for loop
- Use starred unpacking to collect the remaining items
- Return several values from a function as a tuple and decide when a tuple fits better than a list
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.