A list — called an array in many programming languages — lets you store multiple values under a single variable name. Rather than creating separate variables for each item in a collection, you can group them all in one list and work through them efficiently. At KS3, lists are essential for writing programs that handle real data.

What is a list and why is it useful?

Imagine you want to store the test scores of ten students. Without lists, you might write:

score1 = 72
score2 = 85
score3 = 61
# ... and so on for all ten students

With a list, you store all ten scores in one place:

scores = [72, 85, 61, 90, 78, 55, 88, 73, 66, 82]

Now you can process all ten scores with a single loop, calculate the total, find the highest score, or check every value against a threshold — without repeating code ten times. Lists make programs scalable: a program that handles 10 students can handle 1000 with no changes to the code structure.

How do you create a list in Python?

A list is created using square brackets, with items separated by commas:

# A list of integers
scores = [72, 85, 61, 90, 78]

# A list of strings
names = ["Aisha", "Marcus", "Priya", "Jordan"]

# A mixed list (Python allows this; some languages do not)
mixed = [42, "hello", True, 3.14]

# An empty list
empty = []

The len() function tells you how many items are in a list:

print(len(scores))   # 5
print(len(names))    # 4

How does indexing work in a list?

Just like strings, lists use zero-based indexing — the first item is at index 0.

names = ["Aisha", "Marcus", "Priya", "Jordan"]
#  index:    0        1        2        3

print(names[0])    # Aisha
print(names[2])    # Priya
print(names[-1])   # Jordan (last item)

You can also update an item by assigning to its index:

names[1] = "Mohammed"
print(names)   # ["Aisha", "Mohammed", "Priya", "Jordan"]

This is different from strings, which are immutable — you cannot change individual characters in a string, but you can change individual items in a list.

How do you add and remove items from a list?

Operation Method / Syntax Effect
Add to end list.append(item) Adds item as the last element
Add at position list.insert(index, item) Inserts item at the given index
Remove by value list.remove(value) Removes the first occurrence of value
Remove by index list.pop(index) Removes and returns the item at index; pop() with no argument removes the last item
Find position list.index(value) Returns the index of value
Sort ascending list.sort() Sorts the list in place
Reverse list.reverse() Reverses the list in place
fruits = ["apple", "banana", "cherry"]
fruits.append("date")         # ["apple", "banana", "cherry", "date"]
fruits.insert(1, "blueberry") # ["apple", "blueberry", "banana", "cherry", "date"]
fruits.remove("banana")       # ["apple", "blueberry", "cherry", "date"]
print(fruits)

How do you loop through a list?

One of the most powerful things you can do with a list is process every item using a loop. Python's for loop is designed for exactly this:

scores = [72, 85, 61, 90, 78]

for score in scores:
    print(score)

Output:

72
85
61
90
78

To loop through a list and also keep track of the index, use enumerate():

names = ["Aisha", "Marcus", "Priya"]
for index, name in enumerate(names):
    print(index, name)

Output:

0 Aisha
1 Marcus
2 Priya

A worked example: quiz score tracker

The following program stores a set of quiz scores in a list, then calculates the total, average, highest, and lowest scores:

scores = []
num_students = 5

for i in range(num_students):
    mark = int(input("Enter score for student " + str(i + 1) + ": "))
    scores.append(mark)

total = 0
for score in scores:
    total = total + score

average = total / num_students
highest = max(scores)
lowest = min(scores)

print("Total:", total)
print("Average:", round(average, 1))
print("Highest:", highest)
print("Lowest:", lowest)

Run with scores 72, 85, 61, 90, 78:

Statistic Value
Total 386
Average 77.2
Highest 90
Lowest 61

The max() and min() built-in functions work directly on lists, returning the largest and smallest values respectively.

Frequently asked questions

What is the difference between a list and an array?

In Python, the built-in list type is the standard data structure for ordered collections. In many other languages (Java, C#, pseudocode) the equivalent is called an array. The core concept is the same: store multiple values under one name and access them by index. The main practical difference is that Python lists can hold items of mixed types and can grow or shrink dynamically, whereas arrays in some languages must be declared with a fixed size and a single data type.

Why does Python start indexing at 0?

Zero-based indexing is a convention inherited from lower-level programming languages. The index represents an offset from the start of the list in memory: the first item is 0 positions from the start, the second is 1 position from the start, and so on. While it can feel counterintuitive at first, it becomes natural very quickly and is consistent with how strings, and most other sequences, are indexed in Python.

How do you find the length of a list in Python?

Use the built-in len() function: len(my_list) returns the number of items. The valid indices for a list of length n are 0 through to n - 1. A common mistake is trying to access my_list[n], which causes an IndexError: list index out of range.

How is a list different from a variable?

A variable stores a single value. A list stores an ordered collection of multiple values, all accessible through the same name using an index. For example, score = 85 is a single variable; scores = [72, 85, 61] is a list that holds three values. You can think of a list as a single row of labelled boxes, where each box holds one value and each label is a number starting from 0.


For Socratic computing tutoring at KS3 and GCSE — see aitutors.me.