Community resourceWorksheet

OCR H446 1.4.2 Arrays, records, lists and tuples

Part 1 of 6 · H446 Data Structures and OOP

This worksheet introduces four ways to organise related data: arrays, records, lists and tuples. Pupils work through examples and tasks such as calculating totals from two-dimensional lists and filtering records based on conditions. The material develops understanding of data structures, their properties and appropriate uses, providing a moderate challenge suitable for foundational programming learning.

Shared by Chris H.Verified teacher

  • 14 cells
  • CC BY-SA 4.0
  • Shared 29 Jul 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

Choosing and representing data

OCR H446 reference: 1.4.2(a)

Programs rarely work with just one value. A game stores the scores from many rounds, a music app stores information about thousands of tracks, and a science experiment records measurements taken at regular intervals. The way this related data is organised affects how clearly and reliably a program can use it.

In this worksheet, you will compare arrays, records, lists and tuples. OCR pseudocode and Python sometimes use these words differently, so each idea is explained carefully before you apply it.

You should already know how to create a Python list, use an index and write a for loop.

By the end, you should be able to:

  • distinguish arrays, records, lists and tuples
  • explain why a structure suits a particular situation
  • traverse a two-dimensional structure
  • process a collection of records in Python

Four ways to organise related data

The best structure depends on the shape of the data and what the program needs to do with it. Begin with the situation, rather than choosing a structure only because its name is familiar.

Array: indexed positions with a fixed shape

An array stores values in numbered positions called indices. In OCR questions, an array normally:

  • has a fixed size once it has been created
  • contains values of the same data type
  • has one, two or three dimensions

A one-dimensional array could store the lap times from a karting session. A two-dimensional array could store one row of sensor readings for each day of a week.

OCR-style pseudocode

array lapTimes[3]
lapTimes[0] = 52.4

Python does not have the same built-in, fixed-size array used in OCR pseudocode. We will often use a Python list to model the indexed positions:

# Python comparison

lap_times = [52.4, 51.8, 53.1]

This is a useful comparison, but remember the difference: a Python list can grow, shrink and mix data types, while the OCR array model is fixed-size and normally uses one type.

Record: several named facts about one item

A record groups fields that all describe one item. The fields have meaningful names and may use different data types.

For example, one film record could keep its title, running time and whether it is available to stream. Those values belong together even though they are not all the same type.

# A Python comparison to one OCR record
film = {
    "title": "Hidden Figures",
    "running_time": 127,
    "available": True
}

A Python dictionary is a clear comparison because each field name is used as a key.

List: an ordered collection that can change size

A list is ordered and dynamic: items can be added or removed while the program runs. A music playlist is a natural example because tracks may be added, removed or reordered.

playlist = ["Track A", "Track B", "Track C"]
playlist.append("Track D")

Python lists are flexible, but a well-designed list still has a clear purpose. Mixing unrelated values simply because Python permits it usually makes a program harder to understand.

Tuple: an ordered collection intended to stay unchanged

A tuple is ordered and immutable, which means its values cannot be replaced after the tuple has been created.

video_resolution = (1920, 1080)

The width and height form one fixed pair. A tuple communicates that the pair should be treated as a stable value rather than a collection that will be edited repeatedly.

A useful decision check

Ask these questions:

  1. Do I need named fields describing one item? Consider a record.
  2. Do I need fixed indexed positions of one type? Consider an array.
  3. Must the ordered collection grow or shrink? Consider a list.
  4. Should the ordered values remain unchanged? Consider a tuple.
Worked example
# A two-dimensional structure: one row per student
quiz_scores = [
    [7, 8, 6],
    [9, 8, 10]
]

# A collection of records: one dictionary per student
student_records = [
    {"name": "Amina", "year_group": 12},
    {"name": "Ben", "year_group": 12}
]

# Row 0, column 1
print("Amina's second score:", quiz_scores[0][1])

# Record 1, then the name field
print("Second student's name:", student_records[1]["name"])
Fill in the blanks
Fixed indexed positions containing values of the same type: ______. A dynamic ordered collection that can grow or shrink: ______. An immutable ordered collection: ______.
  • array
  • record
  • list
  • tuple
Multiple choice1 mark

A program stores one student's name, candidate number and average mark together. Which OCR data structure best describes this?

  • AA three-dimensional array
  • BA stack
  • CA tuple containing only one value
  • DA record

Checkpoint: identify the shape before coding

Pause and describe each structure in one sentence. If two descriptions sound the same, return to the feature that separates them.

  • An OCR array has fixed indexed positions and normally one data type.
  • A record groups named fields about one item.
  • A list is ordered and can change size.
  • A tuple is ordered and immutable.

The next tasks move from recognising the structures to using them. When you justify a choice, avoid saying only that it is "easier". Name the useful feature and explain what that feature allows the program to do.

Starter code
# A small seating plan modelled as a two-dimensional list
seats = [
    ["Amina", "Ben", "Cara"],
    ["Dev", "Eli", "Farah"]
]

# Try these changes:
# 1. Print Cara's name using two indexes.
# 2. Change "Eli" to "Eva".
# 3. Print the whole second row.

Task 1: calculate totals from a tournament score table

A school gaming tournament records three round scores for each player. The two-dimensional structure uses:

  • one inner list for each player
  • one integer for each round score

Your result must be a new one-dimensional list called student_totals. It should contain one total for each player, in the same order as the original rows.

For example, rows [2, 3] and [4, 5] would produce [5, 9].

Use this approach:

  1. Start with the empty student_totals list provided.
  2. Use a for loop to visit one player's row at a time.
  3. Calculate the total of that row.
  4. Append the total to student_totals.

You may use Python's sum() function. You do not need to print the result because the checks inspect the completed list directly.

Coding task3 marks
# Each inner list contains one student's three quiz scores.
quiz_scores = [
    [7, 8, 6],
    [9, 8, 10],
    [6, 7, 8]
]

# Create an empty list called student_totals.
# Use a for loop to add the total for each student.
student_totals = []

Choosing a suitable structure in an unfamiliar context

Exam questions often reward the reason for a choice, not just the structure's name. A useful explanation links three parts:

feature -> immediate effect -> benefit in the situation

For example:

A record groups named fields about one laptop. Its asset number, model and repair status therefore remain together, reducing the risk that the program associates a repair status with the wrong device.

Notice that the explanation does more than say a record is "organised" or "easy to use". It identifies the feature, explains its effect and applies that effect to the context.

When choosing, ask:

  • Is this one item with several named facts?
  • Is the collection fixed or expected to change?
  • Does index position have a meaning?
  • Should the values remain unchanged?
  • Will the program need to add, remove or update items?
Written answer3 marks

A school stores an asset number, model name, purchase date and repair status for every laptop. Explain why a record is suitable for representing one laptop.

Use a linked explanation: identify a feature of a record, explain its effect, then apply it to the laptop data.

Students type their answer here.

Task 2: filter a collection of records

The variable books is a list of dictionaries. Each dictionary is a readable Python comparison to one OCR record.

Your program must examine every book and keep only the titles that meet both conditions:

  • the book has at least 300 pages
  • the book is currently available

Build a list of title strings, not a list of whole dictionaries. A useful pattern is:

  1. Loop through books, using a variable such as book for the current record.
  2. Read a field with syntax such as book["pages"].
  3. Use one if statement to test both conditions.
  4. Append book["title"] when both conditions are true.

The final order should match the order of the qualifying books in the original data.

Coding task4 marks
# Each dictionary is a Python version of a record.
books = [
    {"title": "Dune", "pages": 412, "available": True},
    {"title": "Coraline", "pages": 192, "available": True},
    {"title": "Nineteen Eighty-Four", "pages": 328, "available": False},
    {"title": "The Hobbit", "pages": 310, "available": True}
]

# Create a list called long_available_titles.
# Use a loop and selection to add the title of every book
# that has at least 300 pages and is available.
long_available_titles = []
Written answer2 marks

State one difference between a list and a tuple. Then give one situation in which a tuple would be suitable and explain why.

Retrieve the answer from memory before checking your notes.

Students type their answer here.