GCSE · Computer Science · OCR · Spec J277

Records

Your game needs to remember a username, a password and a top score for each player. Three separate scraps of data, or one neat bundle?

Computer Science · Records

Sort the player's record

A game stores a record about one player. Sort each item: is it the entity, an attribute (field), or the data?

Still to sort

Entity (0)

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

Where the line is: The entity is what the record describes. It is not one of the properties and not a stored value.

Attribute (field) (0)

A property or characteristic of the entity. Also called a field.

Where the line is: An attribute is the name of the property. The actual value stored under it is the data.

Data (0)

The actual value stored for an attribute.

Where the line is: Data is the value itself, such as a name typed in or a score reached.

7 of 7 still to sort.

Every item here belongs to exactly one job.

Exam line: Entity = who, attributes = what we store, data = the actual values.
Watch out: A value like 5,328 is not an attribute. The attribute is the label it sits under.

Records

Can a record change shape?

Your game has a Player record with username, password and top score. A new idea comes along.

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

Exam line: A record is a static data structure: the size is fixed at declaration.

Records

Declare the Player record

Complete this pseudocode that declares a Player record. This is an illustration of the idea, not a notation you must copy exactly.

  1. record PlayerName the record after the entity it describes.
  2. missing step
Which line is step 2?

Exam line: Declare the structure: each attribute and its data type.

Records in Python

Dictionary used as a recordvsList

Python has no native data structure for a record, so a dictionary can stand in.

Focus

How you get data out

Dictionary used as a record

Use the key.

List

Use the index.

The insight

The decisive difference: a key names something, an index is only a position.

What identifies the username data

Dictionary used as a record

The key for the username attribute.

List

Its index.

What the structure is

Dictionary used as a record

A data structure of data pairings, each located using a key.

List

A structure whose items are accessed by their index.

Predict, then check

Your game now has lots of players, and Python has no native record.

How could a program store the records for many players?

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

What you need to know

  • Data structures store data in an organised and accessible way, and a record is one example.
  • A record collects the attributes of a single entity.
  • An entity is a single object, place, person or thing, such as a player, a customer, a book or a car.
  • Have a goA shop stores information about each of its customers. Is 'a customer' the entity, an attribute or the data?

    The entity.

    A customer is a single person the record is about, not a property of something else or a stored value.

  • Attributes are the properties or characteristics of an entity, and are sometimes called fields.
  • In a player record, the player is the entity, username, password and top score are the attributes, and "rockstar9", "6goatsEating" and 5,328 are the data.
  • Have a goYour mate Sam says 5,328 is an attribute because it is a number. Convince him otherwise in one sentence.

    5,328 is data. The attribute is top score.

    An attribute is the property, and the data is the actual value stored under it.

  • When a record is declared, each attribute and its data type, such as string or integer, is determined and then fixed.
  • A record is a static data structure, so its size is fixed at declaration and does not change.
  • Have a goSomeone declares a Player record, then wants to give one player's record an extra attribute. Does the record's size change?

    No. The size is fixed at declaration.

    A record is a static data structure, unlike a list that you can keep adding to.

  • In pseudocode you declare a record by listing each attribute with its data type.
  • A database holds many records for one entity, all with the same attributes but different data.
  • Python has no native record, so a dictionary of key-and-data pairings can be used, with each key identifying an attribute.

The big picture

A record is a data structure that collects the attributes of one entity, such as a player. The player is the entity, username, password and top score are the attributes, and values like "rockstar9" and 5,328 are the data. Attributes and their data types are decided when the record is declared and then stay fixed, so every record has the same structure with different data. In Python a dictionary, with a key for each attribute, can represent a record, and a list of dictionaries can hold many.

Key points

1A record collects attributes about one entity.
2Entity = who, attributes = what we store, data = the actual values.
3Attributes and their data types are fixed when the record is declared.
4Every record in a database follows the same fixed structure with different data.
5In Python, a dictionary can represent a record, and a list of dictionaries can hold many.

Worked example

Problem

A shop keeps a record for each customer. One record holds: name "Priya", membership "Gold", points 120. Identify the entity, the attributes and the data, and choose a data type for each attribute.

⚠ Watch out

Treating a record like a list you can keep adding to. A record's attributes and their data types are fixed when it is declared, and every record of that type has the same structure.

🧠

Memory hook

Entity = who. Attributes = what we store. Data = the actual values.

✓

Check yourself

Pick a car as your entity. Name two attributes you would store, give one piece of data for each, and say what cannot change once the record is declared.

Flashcards

(13)
What are data structures used for?
Storing data in an organised and accessible way.
What is a record?
A data structure that collects the attributes of a single entity.
What is an entity?
A single object, place, person or thing, such as a player, customer, book or car.
What is an attribute?
A property or characteristic of an entity. Sometimes called a field.
In the player record, what is 'rockstar9'?
Data: the value stored under the username attribute.
What is decided when a record is declared?
Its attributes and the data type of each, such as string or integer.
Why is a record called a static data structure?
Its size is fixed at declaration and does not change.
How is a record declared in pseudocode?
By declaring the structure, listing each attribute with its data type.
What does a database hold for a particular entity?
Many records, each with the same attributes but different data.
Does Python have a native record type?
No. A dictionary can be used to represent a record instead.
In a dictionary used as a record, what does a key identify?
An attribute. The data is accessed using that key.
How are items accessed in a list?
By their index, not by a key.
How can many records be stored together in Python?
By adding multiple dictionaries to a list, each with the same fixed structure.

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

See the full OCR Computer Science curriculum →

How this lesson was checked. This OCR GCSE Computer Science (specification J277)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 5 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.