Community resourceWorksheet
1CP2-CT-10.1 Records rows fields and two-dimensional structures
Part 1 of 5 · 1CP2-CT-10 · Integrated programming and data structures
A two-dimensional structure stores rows containing related fields. In Python's PLS representation, it is a list of lists. The first index selects a row; the second selects a field inside that row.
Students will:
- represent related fields as typed rows
- use the first index for a row and the second for a field
- preserve the meaning and type of each field
- trace reads from a two-dimensional structure
Inside: 5 explanation cells, 1 fill-in-the-blanks cell, 3 multiple-choice questions, 3 written answers and 1 trace table. 12 marks, about 45 minutes.
Series: 1CP2-CT-10 · Integrated programming and data structures, part 1 of 5.
Shared by Coding PathwayVerified teacher
- 13 cells
- About 45 minutes
- CC BY-SA 4.0
- Shared 17 Aug 2026
Preview
The whole resource, exactly as a class sees it. Answers and marking are held back.
Records, rows, fields and two-dimensional structures
A two-dimensional structure stores rows containing related fields. In Python's PLS representation, it is a list of lists. The first index selects a row; the second selects a field inside that row.
1. Read row then field
In records[1][2], index 1 selects Ben's row and index 2 selects the score field. Each row should follow the same field order. A whole row represents one record; a column position represents one kind of field.
- 2
- field
- row
Given records = [["A", 4], ["B", 7]], what is records[1][0]?
- AA
- B4
- CB
- D7
2. Preserve field meaning and type
A record may contain mixed types: a name string, an integer score and a Boolean membership flag. CSV input begins as text, but after parsing, numeric fields should be converted so comparisons and arithmetic behave correctly.
For clubs = [["Mina", "Chess", 6], ["Owen", "Code", 8]], state the expressions that access Code and 6.
Give one two-index expression for each value.
Students type their answer here.
3. Predict before execution
records = [["Asha", 12], ["Ben", 18], ["Cara", 14]]
total = 0
for row in records:
total = total + row[1]
print(total)
What exact value is printed?
- A3
- B14
- C44
- D121814
Explain why row[1] changes on each loop pass even though the expression is unchanged.
Refer to the current row variable.
Students type their answer here.
Complete the row-traversal trace.
Record row, score and total each iteration.
Use one row for each pass through the loop. Fill in a box only when that value changes on that row, and leave the rest blank.
records = [["A", 3], ["B", 5], ["C", 2]]total = 0for row in records:score = row[1]total = total + scoreprint(total)
| Row | records | total | row | score | Output |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | |||||
| 3 | |||||
| 4 | |||||
| 5 | |||||
| 6 | |||||
| 7 |
Explain why a two-dimensional structure is more suitable than three unrelated lists for records that must be processed row by row.
Link grouped fields to consistency or traversal.
Students type their answer here.
Which statement is accurate?
- AEvery 2D structure is a database
- BThe first index always means a column
- CA row can hold related fields in a fixed order
- DAll fields must be strings
Route forward
You can access rows and fields reliably. Next you will use nested traversal, formatted display and linear search over a named field.