GCSE · Computer Science · Edexcel · Spec 1CP2
Structured data types
Imagine writing down everything the game needs to know about one player. Where does each piece go, and how do you find it again?
Computer Science · Records
One player, three pieces of data
Press Next and watch the record change, one line at a time. Nothing here is run for you: you are watching the idea.
Before each step, guess: what will be different once this line has run?
1 player = {"username": "rockstar9", "password": "6goatsEating", "score": 5328}2 print(player["username"])3 player["score"] = 87564 players = []5 players.append(player)6 print(players[0])
Variables
Output
Step 1: One dictionary, three key–data pairs. Each key (username, password, score) is the name; the data is what sits beside it.
Step through the trace — every value is the lesson’s, not run by the page.
Computer Science · Records
Who is playing which role?
Pick an item, then pick its role: entity, attribute or data.
Still to sort
Entity (0)
The single object, place, person or thing the record is about.
Where the line is: The entity is the whole thing being described, not one of its properties and not a stored value.
Attribute (field) (0)
A property or characteristic of the entity.
Where the line is: An attribute is the name of the property, such as username. The value stored for it is the data.
Data (0)
The actual value stored for one attribute.
Where the line is: Data is the value itself. The label that says what the value is for is the attribute.
Start with one game player. What do we need to remember about them? Each question is an attribute, and each answer is data.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Keep everything about one thing together, then find each piece by its name.
What you need to know
- A data structure stores data in an organised, accessible way. A list is one data structure, and a record is another.
- A record lets you store a collection of attributes for a single entity.
- An entity is a single object, place, person or thing. Its attributes (sometimes called fields) are its properties or characteristics.
- In a player record, player is the entity, username, password and top score are the attributes, and rockstar9, 6goatsEating and 5328 are the data.
Have a goA school stores a record for each student. Invent one entity, one attribute and one piece of data that would be in it.
Entity: a student. Attribute: for example year group. Data: for example 9.
The entity is the single thing described, an attribute is one of its properties, and the data is the value stored for that property.
- A record is static: its attributes and the data type of each attribute are fixed when it is declared, and they are the same for every record of that entity.
- A database will hold many records for an entity, and each one follows exactly the same fixed structure.
Have a goKit says: "I gave my player record a bonus attribute, favourite colour. The other records don't have it. Nobody will notice." Why will this cause trouble?
Every record of an entity has exactly the same fixed attributes.
A record is static: its attributes are fixed when it is declared, so one record cannot quietly gain an extra attribute.
- Python has no native record, so a dictionary stands in. It holds data pairings found by a key, in curly brackets with a colon between each key and its data.
- A list is accessed by index location, but a dictionary is accessed by key, as in player["username"].
Have a goA list called names and a dictionary called player. Which one do you reach into by index location, and which by key?
names (the list) by index location, and player (the dictionary) by key.
Lists locate items by their position. Dictionaries locate data using the key it is paired with.
- player["score"] = 8756 changes the data paired with the key score.
Have a goAfter player["score"] = 8756 has run, what is paired with the key score, and has the key itself changed?
8756 is paired with score. The key has not changed.
The line changes the data paired with that key. The key is the name used to find the data, and it stays the same.
- To store many records, put dictionaries with the same structure in a list, so players[0] gives the record at position 0.
The big picture
A record keeps a collection of attributes for one entity. It is static: its attributes and their data types are fixed when it is declared, the same for every record of that entity, while the data can change. In Python a dictionary represents a record and is searched by key; a list of dictionaries holds many records and is searched by index location.
Key points
Worked example
Problem
A school app stores a record for each pupil, with the attributes name (string), year (integer) and club (string). Write one pupil as a Python dictionary (Asha, year 9, chess), read her club, then change her club to drama.
⚠ Watch out
Reading "static" as "the data can never change". It is the attributes and their data types that are fixed when the record is declared. Also watch the key spelling: Python keys are case-sensitive, so "Score" and "score" are different keys.
Memory hook
Key for the piece, position for the whole: player["score"] finds the data by name; players[0] finds the whole record by place.
Check yourself
Out loud, with the page covered: what is fixed in a record and what can change? Then say how you reach one value in a dictionary compared with one record in a list.
Flashcards
(14)What is a record?
What is an entity?
What is an attribute (or field)?
In a record, what is the data?
Why is a record called a static data structure?
In a static record, what can change and what cannot?
How are many records of one entity held in a database?
Why is a dictionary used to represent a record in Python?
What is a Python dictionary?
How do you get at an item in a list, and how in a dictionary?
What does players[0] give you?
How can Python store several records?
What does RECORD Player ... ENDRECORD declare in pseudocode?
Is "Score" the same key as "score" in Python?
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 postedMore Edexcel GCSE Computer Science topics
- Programming arithmetic operators
- Programming logical operators
- Programming relational operators
- Reading, writing, analysing and refining programs
- Single entry/exit code blocks
- String manipulation
- Structural components of programs
- User input handling
- Validation – length check
- Validation – presence check
- Validation – range check
- Variables and constants in programs
How this lesson was checked. This Edexcel GCSE Computer Science (specification 1CP2)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 21 November 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.