GCSE · Computer Science · Edexcel · Spec 1CP2

Records

Every new player fills in the same boxes: username, password, top score. The boxes never change. Only what gets typed into them does. That, right there, is a record.

Computer Science · Records

One player, one record: sort every piece

Entity, attribute or data? Pick a piece, then give it a job.

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’s 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’s one player’s record taken apart, plus three pieces from a second player. Sort them before anyone tells you the answers.

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

Record or database?

One record, or the whole lot?

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

Be honest: 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. A dictionary does the job instead: curly brackets, with each key paired with its data.

Before you step past line 5, call it: what will print(player["Password"]) show?

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 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. The key "Password" itself 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 and follow the route from the whole list down to one single value.

Find 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 Sam fixed at declaration. 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

  • A data structure keeps data organised and accessible, so you can actually reach it again. A record is one example.
  • A record stores a collection of attributes for one single entity.
  • The entity is that single object, place, person or thing the record is about.
  • Attributes, also called fields, are the entity’s properties or characteristics. The data is the values stored in them.
  • Have a goA library keeps a record for each book. One book has "Wild Seas" in its title box. Name the entity, the attribute and the data.

    Entity: the book. Attribute: title. Data: "Wild Seas".

    Title is the box every book’s record has, so it is the attribute; "Wild Seas" is only what this one book has in it. Calling the title the entity mixes up a property with the thing itself.

  • In a player record: player is the entity; username, password and top score are attributes; "rockstar9", "6goatsEating" and 5,328 are data.
  • A record is static: you decide its attributes and their data types at declaration, and it does not change in size.
  • That structure is then fixed for every record used in the database.
  • Have a goYour mate Jaz declares a player record with three attributes, then says: “I’ll just give the next player a fourth one, Favourite Snack.” What’s wrong with Jaz’s plan?

    The attributes were fixed at declaration, so every record must keep the same three.

    Static means the structure, not the data, is fixed. Jaz can change what a player’s data says, but adding an attribute to one record breaks the shared structure.

  • A database holds many records for a particular entity, like many player records. One player, one record.
  • Python has no native record, so a dictionary in curly brackets stands in. player["Username"] finds data; assigning to player["Password"] changes it.
  • For many records, put dictionaries with exactly the same structure in a list. players[0] is the record at position 0.
  • Have a goplayers holds three player dictionaries. Write the code that reaches the username of the first player in the list.

    players[0]["Username"]

    players[0] picks the first record because positions start at 0, then the key "Username" finds its data. players[1] would land on the second player.

The big picture

A record is a data structure that stores the attributes of one single entity, like one player in a game. The entity is who or what the record is about, the attributes (also called 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. Python has no native record, so a dictionary stands in: keys find and change the data, and a list of dictionaries holds many records.

Key points

1Entity = the one thing the record is about. Attributes (fields) = 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: attributes and data types are set at declaration (e.g. RECORD Player … ENDRECORD), its size does not change, 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] is 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. They sit side by side, so it’s an easy slip. "Username" is the attribute: the box every player’s record has. "rockstar9" is the data one player stored in it. Quick test: every record has the same attributes; the data can differ.

🧠

Memory hook

Same form, different answers. Who the form is about is the entity. The questions printed on the form are the attributes. Whatever gets written in is the data.

✓

Check yourself

No 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?
Keeping data organised and accessible, so you can reach the bit you need. A record is one example.
What does a record store?
A collection of attributes for one 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 else is it called?
A property or characteristic of the entity. Its other name is a field.
Attribute or data: how do you tell them apart?
The attribute is the property every record has (e.g. username). The data is the value one entity has stored in it (e.g. "rockstar9").
What is a database?
Many records for a particular entity, such as 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 that structure is fixed for every record in the database.
What does a pseudocode record declaration look like?
It opens with RECORD and a name, lists each attribute with its data type (such as a string or an integer), and closes with ENDRECORD.
Does Python have a built-in record data structure?
No. A dictionary, written with curly brackets, is used to represent a record.
How do you find one attribute’s data in a Python dictionary?
Put its key in square brackets after the dictionary’s name, e.g. player["Username"].
How do you change the data in a dictionary record?
Assign a new value to its key with a single =, e.g. player["Password"] = "newValue". The key stays the same.
How do you store many records in Python?
Add several dictionaries to a list, each following exactly the same fixed structure.
In a list of records called players, what is players[0]?
One whole record: the dictionary at position 0 of the list, which is the first one.

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 26 October 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.