Learn how to use 2D arrays (lists of lists) in Python to store and analyze data — in this case, students and their GCSE subject grades.
You’ve just been hired as the Data Wizard 🧙‍♂️ at “Parkside High School.”
Your job? To help teachers manage student grades for GCSE subjects using Python code!
Each row in your 2D array will represent one student, and each column will represent a subject or their name.
Let’s start with 4 students and 3 subjects: Maths, English, and Science.
# GCSE Class Data [Name, Maths, English, Science]
class_data = [
    ["Ava", 7, 8, 6],
    ["Ben", 5, 6, 7],
    ["Chloe", 9, 8, 8],
    ["Dylan", 6, 5, 5]
]
Each inner list is one student’s data.
👉 The first item is their name, and the next three are their grades.
print("Name   Maths English Science")
print("--------------------------------")
for student in class_data:
    print(f"{student[0]:<8} {student[1]:<6} {student[2]:<8} {student[3]}")
âś… Output:
Name   Maths English Science
--------------------------------
Ava   7   8    6
Ben   5   6    7
Chloe  9   8    8
Dylan  6   5    5
You can access values using row and column indexes:
# Example: print Chloe’s English grade
print("Chloe’s English grade:", class_data[2][2])
# Update Dylan’s Science grade
class_data[3][3] = 6
print("Dylan’s new Science grade:", class_data[3][3])
đź§ Try It Yourself:
Print Ava’s Maths grade.
Increase Ben’s English grade by 1 point.
Print the updated table again.
highest_math = 0
top_student = ""
for student in class_data:
    if student[1] > highest_math:
        highest_math = student[1]
        top_student = student[0]
print(f"The top Maths student is {top_student} with a grade of {highest_math}.")
đź§ Challenge:
Modify the code to find the top student in English.
Then do the same for Science.
for student in class_data:
    avg = (student[1] + student[2] + student[3]) / 3
    print(f"{student[0]}'s average grade: {avg:.1f}")
🎯 Extension:
Who has the highest overall average?
(Hint: keep track of the highest average and the student’s name, like you did in Step 4!)
Let the user type a student’s name, and display all their grades.
Add another subject (e.g. History or Computer Science).
Add more students!
Try using input() so the teacher can enter grades interactively.
📝 Discuss or write about:
What’s the difference between a 1D list and a 2D list?
Why is a 2D list useful for storing classroom data?
How could schools or apps use this kind of data structure in real life?
Please complete the form once finished.
https://forms.gle/1XdGs6cmWX3bxs7VA