Skip to main content

Section 16.13 Review - Lists

Practice indexing, updating, traversing, and using common list operations.

Subsection 16.13.1 Part A: Read the List

Checkpoint 16.13.1.

colors = ["red", "blue", "green", "yellow"]
Identify the first item, the last item, the item at index 2, and the length of the list.

Subsection 16.13.2 Part B: Trace

Checkpoint 16.13.2.

numbers = [10, 20, 30]
numbers.append(40)
numbers[1] = 99
numbers.pop(0)
Trace the value of numbers after each line.

Subsection 16.13.3 Part C: Fix

Checkpoint 16.13.3.

The code below has an error. Update it so it runs correctly.

Checkpoint 16.13.4.

The code below has an error. Update it so it runs correctly.

Checkpoint 16.13.5.

The code below has an error. Update it so it runs correctly.

Subsection 16.13.4 Part D: Create

Checkpoint 16.13.6.

Write a list named foods containing four food names. Print the second item, add one more item, and replace the first item with a new value.

Subsection 16.13.5 Think About ...

Checkpoint 16.13.7.

What is the difference between changing a list item and adding a new list item?
You have attempted of activities on this page.