Arrays, 2D arrays and records

When a program has lots of related values, store them together in a data structure instead of in dozens of separate variables.

Practise this lesson free (6 questions)

More tools

One-dimensional arrays (lists)

scores = [12, 7, 19, 4]
Items are numbered from 0: scores[0] is 12 and scores[2] is 19.
len(scores) gives 4. scores.append(10) adds 10 to the end.
scores[1] = 8 changes the second item.
In Python, arrays are written as lists.

Two-dimensional arrays

A 2D array is a list of lists, like a table of rows and columns.
grid = [[3, 8, 1], [6, 2, 9]]
grid[row][column]: grid[1][2] is row 1, column 2, which is 9.
Itemcol 0col 1col 2
row 0381
row 1629

Records

A record groups related fields that can be of different data types, such as one student's details.
student = ["Zara", 15, 62.5, True] (name, age, height, member)
A table of students can be stored as a list of records.
Worked example

temps = [14, 17, 12, 20]. Find the average with a loop.

  1. Add the items: 14 + 17 + 12 + 20 = 63
  2. Divide by len(temps) = 4

Answer: 15.75

Key idea

Lists (arrays) store many values under one name, indexed from 0. A 2D array is a list of lists: grid[row][column]. A record groups related fields of different types.

Key words
Array
A data structure holding many items of the same type under one name, accessed by index (a list in Python).
Record
A data structure grouping related fields that can be of different types.

All GCSE and International GCSE Computer Science key terms and definitions →

Quick check

Try two quick questions

See if it has sunk in. Answers are marked straight away.

Extra practice

2 more questions

Try each one, then tap to check.

  1. scores = [9, 14, 6, 21]. What is scores[3]?

    Show the answer

    Answer: 21

    Index 0 is 9, 1 is 14, 2 is 6, 3 is 21.

  2. What does this print?
    names = ["Ali", "Bea", "Cai", "Dev"]
    names.append("Eve")
    names.append("Fin")
    print(len(names))

    Show the answer

    Answer: 6

    There were 4 names and 2 were appended: 6.

Check you have got it

Answer 6 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.

Video for this lesson coming soon. Subscribe on YouTube

Sources and references

Facts checked against the sources below, 17 October 2026. Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.

What do exam command words like explain and evaluate mean? →

Related lessons