Lists and arrays: Edexcel GCSE practice
1D and 2D lists, indexes and loops. 14 questions in the style of the Edexcel GCSE exam.
Sample questions
`scores = [12, 7, 19, 4]`. What is the value of `scores[2]`?
- 7
- 19
- 4
- 12
What does this program print?
grid = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
print(grid[1][2])
print(grid[2][0] + grid[0][1])What does this program print?
data = [3, 8, 1, 6]
total = 0
for x in data:
if x > 2:
total = total + x
print(total)
print(total / len(data))