GCSE · Computer Science · Edexcel · Spec 1CP2

Records

Every player who joins a game fills in the same form: username, password, top score. The boxes never change; only the answers do. That is a record.

Computer Science · Records

One player, one record: sort every piece

Is each piece the entity, an attribute or data?

Still to sort

Entity (0)

The one thing the record is about: a single object, place, person or thing.

Where the line is: The entity is the whole player. It is not any one fact about the player.

Attribute (0)

A property of the entity, like the label on a box in the form. Also called a field.

Where the line is: An attribute is the label on the box. Whatever gets written in the box is data.

Data (0)

The actual value stored for one attribute.

Where the line is: Data can differ from one player to the next. The attributes stay the same for every player.

10 of 10 still to sort.

Here is one player’s record taken apart, plus three pieces from a second player. Pick a piece, then pick its job.

Watch out: Don’t judge a piece by how it looks. "Password1" looks like an attribute name, but it is sitting in the password box, so it is data.

Record or database?

One record, or the whole lot?

The game now has lots of players, and it keeps a username, a password and a top score for every one of them.

Which is closest to what you think right now?
How sure are you?

Computer Science · Python

Build a record in Python, then read it and change it

Python has no built-in record type. Instead, a dictionary does the job: curly brackets, with each key paired with its data.

Before you reach step 3, predict: what will player["Password"] hold after line 5 runs?

1 player = {"Username": "rockstar9",
2 "Password": "6goatsEating",
3 "TopScore": 5328}
4 print(player["Username"])
5 player["Password"] = "7goatsDancing"
6 print(player["Password"])

Variables

player["Password"]="6goatsEating"player["TopScore"]=5328player["Username"]="rockstar9"

Output

 

Step 1: Lines 1–3 are one statement. The curly brackets make a dictionary, and each key ("Username", "Password", "TopScore") is paired with its data. This dictionary is one player’s record.

1 / 4

Step through the code and watch the record change. Every value shown is written into the lesson; the page runs no code.

Step 1 of 4: Lines 1–3 are one statement. The curly brackets make a dictionary, and each key ("Username", "Password", "TopScore") is paired with its data. This dictionary is one player’s record..

Watch out: The key goes inside the square brackets: player["Password"]. Assigning to it changes the data, and the key "Password" stays exactly as it was.

Computer Science · Data structures

A database in Python: a list of player records
players = [[0]{"Username":"rockstar9","Password":"6goatsEating","TopScore":5328},[1]{"Username":"pixelfox","Password":"Password1","TopScore":912},[2]{"Username":"moonbeam","Password":"tr4inSet","TopScore":47}]

Showing 1 layer: Player records

Explore

Tap a part of the diagram, or choose one below.

A data structure keeps data organised so you can reach any piece of it. Tap each part to see how you get from the whole list to one single value.

Spot the broken record

Which record doesn’t fit?

Sam planned the player record in pseudocode (lines 1–5), then built the database in Python (lines 6–10). One line breaks the structure that was fixed when the record was declared. Which one?

Sam’s code — which line goes wrong?

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

One entity, a fixed set of attributes, and the data that fills them in.

What you need to know

  • Data structures store data in an organised, accessible way, and a record is one example.
  • A record stores a collection of attributes for a single entity.
  • An entity is a single object, place, person or thing. Attributes (fields) are its properties or characteristics, and data is the values stored in them.
  • A record is static: its attributes and data types are decided at declaration and are then fixed for every record in the database.
  • A database holds many records for a particular entity, such as many player records.
  • In Python a dictionary (curly brackets) can represent a record. A key locates the data, e.g. player["Username"], and assigning to a key changes the data.
  • Many records can be stored as a list of dictionaries with exactly the same structure, and players[0] is the record at position 0.

The big picture

A record is a data structure that stores the attributes of a single entity, such as one player in a game. The entity is what the record is about, the attributes (fields) are its properties, and the data is the values stored in them. A record is static: its attributes and data types are fixed at declaration, so every record in a database shares one structure. A database holds many records for the same kind of entity. In Python, a dictionary represents a record, keys find and change its data, and a list of dictionaries holds many records.

Key points

1Entity = the one thing the record describes. Attributes = the properties stored about it. Data = the values filled in.
2In a player record, the player is the entity; username, password and top score are attributes; "rockstar9", "6goatsEating" and 5,328 are data.
3A record is about one entity. A database is many records for the same kind of entity.
4A record is a static data structure. Its attributes and data types are set at declaration (e.g. RECORD Player … ENDRECORD), it does not change in size, and every record follows the same structure.
5Python represents a record with a dictionary: player["Username"] reads the data and player["Password"] = "new" changes it.
6A list of dictionaries holds many records; players[0] gives the record at position 0.

Worked example

Problem

players is a list of player records, each a dictionary with the keys "Username", "Password" and "TopScore". Write one line of Python that changes the password in the record at position 0 to "luckyOtter3".

⚠ Watch out

Mixing up an attribute with its data. "Username" is the attribute: the property every record has. "rockstar9" is the data stored in it for one player. Quick test: every player has the same attributes, and the data is what one player’s record holds in them.

🧠

Memory hook

Same form, different answers. The entity is who the form is about, the attributes are the questions on the form, and the data is the answers.

✓

Check yourself

Without scrolling up: for one player’s record, name the entity, one attribute and its data. Then say what makes a record static, and write the Python that reads player’s "TopScore".

Flashcards

(13)
What is a data structure for?
Storing data in an organised and accessible way. A record is one example.
What does a record store?
A collection of attributes for a single entity.
What is an entity?
A single object, place, person or thing that a record stores data about.
What is an attribute, and what is its other name?
A property or characteristic of the entity. Attributes are sometimes called fields.
Attribute or data: how do you tell them apart?
The attribute is the property (the label, e.g. username). The data is the value stored in it for one entity, e.g. "rockstar9".
What is a database?
Many records for a particular entity, for example many player records.
Why is a record called a static data structure?
Its attributes and their data types are decided at declaration, it does not change in size, and they stay fixed for every record in the database.
How does pseudocode declare a record structure?
Between RECORD and ENDRECORD, naming each attribute with its data type, e.g. a string or an integer.
Does Python have a built-in record data structure?
No. A dictionary, written with curly brackets, is used to represent a record.
In a Python dictionary record, how do you find one attribute’s data?
Use its key in square brackets after the dictionary name, e.g. player["Username"].
How do you change the data in a dictionary record?
Assign a new value to the key, e.g. player["Password"] = "newValue".
How do you store many records in Python?
Add several dictionaries to a list, each following exactly the same fixed structure.
What does players[0] give you?
The record at position 0 of the list: one whole dictionary.

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 Edexcel GCSE Computer Science topics

See the full Edexcel Computer Science curriculum →

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 30 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.