Skip to main content
Module 1 · Learning to Drive

Lesson 1-12 · Python Final Project — Knowledge ChecksAnswer key

Correct answers are marked and the explanation follows each question.

  1. You're about to build a 60-block-worth Python program. What's the smartest way to start?

    1. A.Write the whole thing, then run it once at the end
    2. B.Write and test one small function at a time, then combine them✓
    3. C.Copy a classmate’s program
    4. D.Skip planning and improvise

    Build and test in small pieces (unit testing), then integrate. It's far easier to find a bug in one small function than in a giant program.

  2. What is the difference between these two ways of describing a function?

    # Return the exterior angle
    def calculate_angle(sides):
        """Return the exterior angle."""
    1. A.The docstring is kept by Python and can be read back by tools like help(); the comment is discarded✓
    2. B.There is no difference — both are ignored by Python
    3. C.The comment is kept and the docstring is discarded
    4. D.Docstrings are only allowed at the top of a file

    Both are for humans, but only the docstring survives: Python attaches it to the function, so help() and your editor can show it. A comment is thrown away once the file is read.

  3. Your program runs but the robot behaves differently each time on the same code. Most likely cause?

    1. A.A syntax error
    2. B.Physical factors — wheel slip, surface, or battery level✓
    3. C.The function names are wrong
    4. D.Python is broken

    If the code is unchanged and the result varies, it's usually physics — grippier surface, fresher battery, or wheel slip — not a code bug.