Skip to main content
Module 1 · Learning to Drive

Lesson 10 · Python Functions — Knowledge Checks

Name Date
  1. Which keyword defines a function in Python?

    1. A.function
    2. B.def
    3. C.define
    4. D.func

    Answer Why?

  2. Given def square(side_length):, what does calling square(45) make the robot do?

    1. A.Draw a square with 45 cm sides
    2. B.Draw a square with 90 cm sides
    3. C.Turn 45 degrees
    4. D.Cause an error — you must pass two numbers

    Answer Why?

  3. A variable created inside a function (like angle above) can be used…

    1. A.Anywhere in the program
    2. B.Only inside that function — it is local
    3. C.Only after the program ends
    4. D.Only in other functions

    Answer Why?

  4. What's wrong with this? def multiply(x, y)

    1. A.multiply should be capitalized
    2. B.It is missing the colon: def multiply(x, y):
    3. C.x and y need quotes
    4. D.Nothing is wrong

    Answer Why?