Skip to main content
Module 4 · Manhattan Navigation

Lesson 4-3 · The Planner: Every Direction — Knowledge ChecksAnswer key

Correct answers are marked and the explanation follows each question.

  1. Does (1, 3) == (3, 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

    (1, 3) is x = 1, y = 3; (3, 1) is x = 3, y = 1. Different intersections, so False.

  2. For a trip that goes up and to the right, how many of the four while loops actually run?

    1. A.All four
    2. B.Two: the east loop and the north loop✓
    3. C.Just one
    4. D.None: it needs if/else

    At most one x loop (east OR west) and one y loop (north OR south) run for any trip. The other two find their condition False on the first check.

  3. A classmate gets [(3, 3), (2, 3), (1, 2), (1, 1), (1, 0)] for (3, 3) to (1, 0). What went wrong?

    1. A.Nothing: that is a valid Manhattan path
    2. B.The west loop appends before it subtracts 1 from x, so the start is included and (1, 3) is skipped: promise 1 is broken✓
    3. C.The destination tuple is backwards
    4. D.The south loop ran before the west loop

    Swapping the two lines inside a loop (append first, then change x) shifts that leg by one: the start appears and the corner is missed. The first element should never equal the start.

  4. What does separation of concerns let you do here?

    1. A.Run the robot faster
    2. B.Test the path planning on its own, separately from the driving✓
    3. C.Skip testing entirely
    4. D.Combine planning and driving into one function

    Because the planner only computes paths, you can check it on any computer before the robot is involved.