Skip to main content
Module 1 · Learning to Drive

Lesson 1-9 · Variables & Expressions — Knowledge Checks

Name Date
  1. What is the difference between = in math and = in Python?

    1. A.There is no difference
    2. B.In Python it is an instruction: work out the right side, then store the result in the named memory on the left
    3. C.In Python it means "is approximately equal to"
    4. D.In Python it only works with whole numbers

    Answer Why?

  2. After these three lines, what is total?

    total = 10
    total = total + 5
    total = total + 5
    1. A.10
    2. B.15
    3. C.20
    4. D.It causes an error because total is used to define itself

    Answer Why?

  3. In the line reflectance = Reflectance.get_default_reflectance() what is the difference between the two spellings?

    1. A.Nothing — Python ignores capital letters
    2. B.Capitalized Reflectance is the class; lowercase reflectance is the variable holding the sensor you will use
    3. C.The capitalized one is a typo that Python fixes
    4. D.Capitalized names are for numbers, lowercase for text

    Answer Why?

  4. What is the value of 10 + 4 * 2 ?

    1. A.28
    2. B.18
    3. C.80
    4. D.16

    Answer Why?

  5. Your white reading is 0.2 and your black reading is 0.8, and you want the midpoint (0.5). Which line gives it?

    1. A.threshold = white + black / 2
    2. B.threshold = (white + black) / 2
    3. C.threshold = white + black // 2
    4. D.Both of the first two work

    Answer Why?