If a tuple can never be changed, how is `t = (something else)` not an error — and what quietly happens to the original tuple?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
You start with the given t = (2, 'mit', 3). You've decided the middle element should be the integer 3 instead of the string 'mit'. Tuples are immutable, so you can't overwrite t[1].
Build a brand-new tuple that keeps the first and last elements but has 3 in the middle, and assign it to rebuilt.
Immutability of an existing tuple
State that no element of (2, 'mit', 3) can be altered in place, put the integer 5 and the string 'abc' beside it as the same case, and note that new tuples can be built.
Rebinding a name versus changing an object
Trace t first bound to one tuple and then reassigned to a different tuple, recording that the original object stays in memory and only the binding of t moves.
Nested tuples and chained indexing
Take seq = (2, 'a', 4, (1, 2)), record len(seq) as 4, and evaluate seq[3] then seq[3][0] left to right down to 1.
Looping directly over the elements
Write for e in seq: and list the four values e takes in turn, namely 2, 'a', 4, and the tuple (1, 2).