Module 4 · Manhattan Navigation
Lesson 2 · Tuples — Knowledge ChecksAnswer key
Given position = (3, 5), what does position[0] return?
Index 0 is the first element — the row — so position[0] is 3. position[1] would be the column, 5.
What happens when you run position[0] = 5 on a tuple?
Tuples are immutable, so item assignment raises a TypeError. To 'change' a position, create a new tuple.
Does (1, 4) == (4, 1) evaluate to True?
Two tuples are equal only if every element matches in order. (1, 4) is row 1/col 4; (4, 1) is row 4/col 1 — different, so False.
Using this method, what's the Manhattan distance from (1, 1) to (4, 3)?
(4 − 1) rows + (3 − 1) cols = 3 + 2 = 5 steps.