Skip to main content
Module 4 · Manhattan Navigation

Lesson 4-1 · The Main Program — Knowledge Checks

Name Date
  1. The robot is 3 across and 1 up from the corner nearest you. Which line stores that?

    1. A.robot_position = (1, 3)
    2. B.robot_position = (3, 1)
    3. C.robot_position = 3, 1, 0
    4. D.robot_position = [3] + [1]

    Answer Why?

  2. How many lines does this print, and what is the last one?

    STOPS = [(1, 1), (0, 2), (3, 3)]
    for stop in STOPS:
        print("Go to", stop)
    1. A.One line: Go to [(1, 1), (0, 2), (3, 3)]
    2. B.Three lines; the last is Go to (3, 3)
    3. C.Six lines, one for each number
    4. D.Three lines; the last is Go to 3

    Answer Why?

  3. A student calls drive_path(path, robot_position, robot_heading) on its own line, with nothing on the left, then plans the next leg. What goes wrong?

    1. A.Nothing: drive_path() updates robot_position for them
    2. B.robot_position and robot_heading never changed, so the next leg is planned from the old spot
    3. C.Python raises an error about an unused return value
    4. D.The robot drives the path twice

    Answer Why?