Module 4 · Manhattan Navigation
Lesson 4-4 · The Driver — Knowledge ChecksAnswer key
What does this print?
path = [(1, 0), (2, 0), (2, 1)] last = path[2] print(last[1])
Indexes count from 0, so path[2] is the third item, (2, 1). Then last[1] is its second part, y: 1.
The robot moves from (2, 3) to (3, 3). Which direction is that, and what heading?
x went 2 to 3 (x +1) and y stayed 3. Increasing x is moving right, East: heading 1.
Going from (1, 3) to (1, 2), what does get_desired_heading() return?
x is unchanged; y went 3 to 2 (y −1). Decreasing y is moving toward you: South, heading 2.