Lab 6: Knowledge Check

These questions check your knowledge of concepts from this lab. Use the button at the bottom to show your answers once you've attempted them.

  1. True or false: If you store a list in a variable, and then modify that list using a method like .append or .insert, when you access the list using the variable again, the value will be changed.
    True False
  2. What does the .append method of lists return?
    1. Nothing: it just modifies the list you applied it to.
    2. The value that you appended to the list.
    3. The list that you appended to.
  3. If we run the following code, what is the sequence of numbers that gets printed (ignoring formatting)?
    x = 0
    while x < 7:
        x += 2
        print(x)
        x += 2
        print(x)
        x += 2
    print(x)

    1. 2, 4, 6
    2. 2, 4, 6, 8
    3. 2, 4, 8
    4. 2, 4, 8, 10
    5. 2, 4, 8, 10, 12
    6. 2, 4, 8, 10, 14, 16, 18

Table of Contents