GCSE Computer Science

Python lists โ€” GCSE Computer Science

What is a list?

A list stores multiple values in a single variable. Instead of creating ten separate variables for ten scores, you create one list that holds all ten. That's the practical reason lists exist โ€” they let you work with collections of data without writing the same code ten times.

In GCSE Computer Science, lists appear in algorithm questions more than almost anything else. Searching, sorting, and iterating through data all involve lists. Understanding them isn't optional.

Creating and accessing a list

scores = [8, 15, 3, 22, 11]
print(scores[0])   # 8
print(scores[3])   # 22
print(len(scores)) # 5

Lists are zero-indexed. The first item is at index 0, not index 1. This is where most mistakes happen โ€” scores[1] gives you the second item, not the first. len(scores) gives you the number of items in the list.

Adding and removing items

names = ["Alice", "Bob", "Charlie"]
names.append("Diana")
names.remove("Bob")
print(names)  # ['Alice', 'Charlie', 'Diana']

append() adds an item to the end. remove() removes the first occurrence of a value. These are the two list methods that appear most often in GCSE exam questions.

Iterating through a list

scores = [8, 15, 3, 22, 11]
total = 0
for score in scores:
    total = total + score
print(total)  # 59

A for loop that iterates through a list is one of the most common patterns in GCSE Python. On each iteration, the loop variable takes the next value from the list. This is how you calculate totals, find maximums, or count items that meet a condition.

What examiners actually test

List questions typically involve indexing (identifying or retrieving a specific item), iteration (processing all items with a loop), and methods (append, remove, len). The zero-indexing point catches students out consistently โ€” always check whether a question is asking for the item at a given index or the index of a given item. They are not the same question.

Want structured Python lessons? Python Coach covers lists and 26 other lessons with 195 challenges โ€” free 60 teaching day trial.

Start learning →