GCSE · Computer Science · AQA · Spec 8525

Records

A car has a make, model, reg, price and number of doors. Three are text, two are numbers. How do you keep them together under one name?

Computer Science · Data structures

Everything about one car, in one variable

A record is a data structure, which is just a way of storing data so it stays organised and easy to get at. Step through this short Python program and keep your eye on the Variables panel.

Before you press Next: how many variables do you think this program needs to hold everything about one car?

1 car1 = {"make": "Ford",
2 "model": "Fiesta",
3 "reg": "AB12 CDE",
4 "price": 8495.0,
5 "noOfDoors": 5}
6 print(car1["model"])
7 car1["price"] = 7995.0
8 car2 = {"make": "Vauxhall",
9 "model": "Corsa",
10 "reg": "CD34 EFG",
11 "price": 6250.0,
12 "noOfDoors": 3}
13 cars = [car1, car2]
14 print(cars[1]["reg"])

Variables

car1={"make": "Ford", "model": "Fiesta", "reg": "AB12 CDE", "price": 8495.0, "noOfDoors": 5}

Output

 

Step 1: Lines 1 to 5 are one statement, and they make just ONE variable: car1. Each labelled piece (make, model, reg, price, noOfDoors) is called a field. Three fields hold text, price holds a real number and noOfDoors a whole number. Different types, one car. That is a record.

1 / 6

Press Next one step at a time. Each step highlights the line that has just run.

Step 1 of 6: Lines 1 to 5 are one statement, and they make just ONE variable: car1. Each labelled piece (make, model, reg, price, noOfDoors) is called a field. Three fields hold text, price holds a real number and noOfDoors a whole number. Different types, one car. That is a record..

Exam line: A record keeps all the data about one thing under one name, and you reach each piece by its field name, such as car1["price"].

What's in a record?

One record holds…?

Two useful words first. The thing a record describes is called an entity: one car, one book, one student. Each piece of data about it, like the make or the price, is an attribute, and each attribute is stored in a field. Think of a car dealer's form for one car: every box is a field, and the whole filled-in form is the record.

So which is closest to what you think a single record holds?
How sure are you?

The design versus one real car

Record definition (pseudo-code)vsPython dictionary

Most-confused difference first: the definition is the blank form, the dictionary is one form filled in.

Focus

What it describes

Record definition (pseudo-code)

The shape every car must have: its field names and the data type of each. RECORD Car make : String model : String reg : String price : Real noOfDoors : Integer ENDRECORD

Python dictionary

One actual car: each field name paired with that car's value. car1 = {"make": "Ford", "model": "Fiesta", "reg": "AB12 CDE", "price": 7995.0, "noOfDoors": 5}

The insight

The definition is the blank form. The dictionary is one form filled in for one car.

How a field is named

Record definition (pseudo-code)

name : Type, one per field, e.g. price : Real

Python dictionary

A key in quotes, then a colon, then the value, e.g. "price": 7995.0

Data types

Record definition (pseudo-code)

Written out for every field: String, Real, Integer

Python dictionary

Not written. Python takes the type from each value: text in quotes is a string, 7995.0 is a float (a real number), 5 is an integer.

Using one field

Record definition (pseudo-code)

Nothing to use yet: a definition holds no values, it only names the fields.

Python dictionary

Use the key: car1["price"] gives 7995.0

Many cars

Record definition (pseudo-code)

Still just one definition. Every car record follows it.

Python dictionary

One dictionary per car, kept together in a list: cars = [car1, car2]

UK note

This Car definition, in the RECORD … ENDRECORD layout, is the example record given in the AQA specification.

Now you try

Find the bargains

The dealer wants the reg of every car priced under £7000. Fill in the missing lines of this Python program.

  1. car1 = {"make": "Ford", "model": "Fiesta", "reg": "AB12 CDE", "price": 7995.0, "noOfDoors": 5} car2 = {"make": "Vauxhall", "model": "Corsa", "reg": "CD34 EFG", "price": 6250.0, "noOfDoors": 3}Two car records, the same as before.
  2. missing step
Which line is step 2?

Design your own

Write a record definition

A school library wants to store details about each book it owns. Write a record definition called Book with four suitable fields. Give every field a name and a data type. [4 marks]

0 words · your answer stays on this page and is not sent anywhere.

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

One name for everything you know about one thing.

What you need to know

  • A data structure stores data in an organised, accessible way. A record is one example of a data structure.
  • A record stores a collection of attributes (fields) about a single entity, such as one car.
  • The fields in one record can be different data types, e.g. String, Real and Integer.
  • Python has no built-in record, so a dictionary is used to represent one. Many records are held as a list of dictionaries.

The big picture

A record groups the attributes of one entity, like one car, under a single name. Its fields can be different data types. Python has no built-in record, so each record is a dictionary, and many records are kept in a list.

Key points

1A record definition starts with RECORD and the record's name, has one name : Type line per field, and ends with ENDRECORD.
2In Python, read or change a field using its key in square brackets: car1["price"].
3One record = one entity. More entities means more records, not a bigger record.
4To use records in a solution, loop through the list and ask each record for the field you need.

Worked example

Problem

A sports club keeps a record for each member with the fields name : String, age : Integer and feesPaid : Boolean. Write Python to store a member called Priya, aged 15, who has paid, add her to a list called members, then output her age.

⚠ Watch out

Leaving the quotes off a field name. car1[price] looks for a variable called price and fails; car1["price"] asks the record for its price field.

🧠

Memory hook

One form per car: the boxes are fields, the form is the record, the stack of forms is the list.

✓

Check yourself

Cover the page. What does one record hold, and how would you store three records in Python?

Flashcards

(11)
What is a data structure for?
Storing data in an organised and accessible way.
What does a record store?
A collection of attributes about a single entity, e.g. everything about one car.
What is an entity?
The one thing a record describes: a car, a book, a student.
What is a field?
One named attribute inside a record, e.g. make or price. Each field has a data type.
Must all the fields in a record be the same data type?
No. Car mixes String (make), Real (price) and Integer (noOfDoors).
Which two keywords open and close a record definition?
RECORD (followed by the record's name) and ENDRECORD.
How is each field written inside a record definition?
name : Type, e.g. noOfDoors : Integer
Does Python have a built-in record data structure?
No. A dictionary is used to represent a record instead.
Record definition vs Python dictionary: which one holds actual values?
The dictionary. The definition only names the fields and their types.
How do you read the reg field of the dictionary car2?
car2["reg"]
How do you store many records in Python?
Put one dictionary per record into a list, e.g. cars = [car1, car2].

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 29 September 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.