Two-dimensional arrays

About this lesson: Two-dimensional arrays

In short

A 2D array stores a table: scores[row, column]. Pick a cell.

Two-dimensional arrays

What you'll explore

2D arrays: Rows and columns
A 2D array stores a table: scores[row, column]. Pick a cell.
Nested loops: Visit every cell
An outer loop for rows and an inner loop for columns visit every cell. Show the row totals.
1D arrays recap: Visit every item
A 1D array is a single row.
Check yourself: Index
grid is ARRAY[0:2, 0:4].

Also in this lesson

  • Step by step
  • Watch out for these
  • More than the lesson
  • Stretch your brain
  • Try it yourself

Words to know

2D array
A table of values with rows and columns.
Row index
Which row.
Column index
Which column.
Nested loop
A loop inside a loop.

Sources

  • Python documentation: lists
  • Raspberry Pi Foundation, Isaac Computer Science: 2D arrays
  • BBC Bitesize, GCSE Computer Science: arrays
  • Python FAQ: multidimensional lists

An interactive lesson with a live experiment: move the sliders, press the buttons and answer quick questions. 4 short steps and a 8-question quiz. Part of the Family plan. Written and checked by Shalo Lab. Last updated 11 November 2026.

← Library routines · Reading and writing text files →

All lessons in Term 1 · Computing · Age 15