Lesson 5: Tuples & unpacking
A tuple is an ordered sequence — like a list, but fixed: you can't change it after it's created. It's written with round parentheses and is used for groups of values that shouldn't change, like a point (x, y). We'll also learn unpacking: splitting a sequence into several variables in one line.
A tuple is like a framed photo: the order is fixed and you can't swap the contents. Unpacking is opening a package and placing each item in its own slot at once.
- tuple
- An ordered, immutable sequence written with round parentheses.
- immutable
- A value that can't be changed after creation; trying to change it raises an error.
- unpacking
- Splitting a sequence into several variables at once, e.g. x, y = point.