Module 4 · Tuples and dictionaries · Lesson 1 of 6
Sequence types and mutability
Lists, tuples, strings — many of Python's types are sequences: ordered collections you can index and loop over. But sequences split along one crucial line — whether they can be changed after they're created. That property is called mutability.
nums = [10, 20, 30]t = (10, 20, 30)A mutable value, like a list, can be edited in place — swap an element, add one, remove one. An immutable value, like a tuple or a string, is frozen the moment it's made: you can read it all you like, but any attempt to change it is a TypeError.
Why would you ever want something you can't change? Because immutability is a guarantee. It keeps data safe from accidental edits, and — as you'll see — it's what lets tuples do a few things lists simply can't. Let's meet tuples properly.