A student is developing a game played on a 3×3 3 \times 3\,3×3 grid. The grid values are represented in Figure 2.
targetRow = -1
targetCol = -1
for r in range(0, 3):
for c in range(0, 3):
if getGridValue(r, c) == 9:
targetRow = r
targetCol = c
| Column 0 | Column 1 | Column 2 | |
|---|---|---|---|
| Row 0 | 1 | 5 | 8 |
| Row 1 | 2 | 9 | 4 |
| Row 2 | 0 | 7 | 3 |
State the purpose of the program in Figure 1.
298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.