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 | |
|---|---|---|
| 1g = [[1,2],[3,4]] print(g[2][0]) | AError: Use g[0][1] not g[0,1] | |
| 2g = [[1,2],[3,4]] print(g[0,1]) | BOutput: 2 | |
| 3g = [[1,2],[3,4]] g[0][1] | CValid: Returns 2 | |
| 4for row in g: for item in row: print(item) | DError: Row index 2 out of range | |
| 5g = [[1,2],[3,4]] print(g[1][0]) | EOutput: 3 | |
| 6g = [[1,2],[3,4]] print(len(g)) | FOk: Nested loops to traverse |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Nested list — A list that contains other lists as elements.~~grid[row][col]grid = [[1, 2], [3, 4]]
print(grid[0][1])grid = [[1, 2], [3, 4]]
print(grid[1][1])for row in grid:
for item in row:
print(item)grid = [[1, 2], [3, 4]]
print(len( grid))grid = [[1, 2], [3, 4]]
grid[0][0] = 99
print(grid)