Skip to main content
Module 4 · Manhattan Navigation

Lesson 2 · Tuples — Knowledge ChecksAnswer key

Correct answers are marked and the explanation follows each question.

  1. Given position = (3, 5), what does position[0] return?

    1. A.5
    2. B.3
    3. C.(3, 5)
    4. D.An error

    Index 0 is the first element — the row — so position[0] is 3. position[1] would be the column, 5.

  2. What happens when you run position[0] = 5 on a tuple?

    1. A.The row changes to 5
    2. B.You get a TypeError — tuples cannot be modified
    3. C.It creates a new tuple automatically
    4. D.Nothing happens

    Tuples are immutable, so item assignment raises a TypeError. To 'change' a position, create a new tuple.

  3. Does (1, 4) == (4, 1) evaluate to True?

    1. A.Yes — they contain the same numbers
    2. B.No — the parts must match in order, and these are swapped
    3. C.Yes — tuples ignore order
    4. D.It causes an error

    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.

  4. Using this method, what's the Manhattan distance from (1, 1) to (4, 3)?

    1. A.7
    2. B.5
    3. C.3
    4. D.2

    (4 − 1) rows + (3 − 1) cols = 3 + 2 = 5 steps.