Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1nums = [10, 20, 30] print(nums[3]) | AValid: Lists are mutable | |
| 2nums = [1, 2, 3] print(nums(0)) | BOutput: b | |
| 3nums = [5, 10, 15] nums[1] = 99 | CError: Use [] not () for indexing | |
| 4nums[-1] | DError: Index 3 out of range | |
| 5c = ['r','g','b'] print(c[0]) | EOutput: r | |
| 6c = ['r','g','b'] print(c[-1]) | FOk: Last item in list |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
list[0] — Access the first item in the list.~~list[-1]colors = ['red', 'blue']
print(colors[0])nums = [10, 20, 30]
nums[1] = 99pets = ['cat', 'dog']
print('cat' in pets)for fruit in fruits:
print(fruit)colors = ['red', 'blue', 'green']
print(colors[-1])