Immutable means "unchangeable." Once an immutable object is created, its value cannot be altered. Any operation that seems to modify it will actually create a brand new object in memory.
- Analogy: Think of a signed contract. If you need to change a term, you can't just erase it; you have to create an entirely new contract with the updated information.
- Examples from your Canvas:
- Tuples: The coordinates tuple is immutable. The code notes that trying to change an element (coordinates[0] = 5.0) would cause an error.
- Strings, Integers, Floats: These are also immutable. When you do x = 5 and then x = x + 1, you are not changing the number 5. You are creating a new number 6 and reassigning the variable x to point to it.