Arrays: 1D and 2D

About this lesson: Arrays: 1D and 2D

In short

An array stores many values of the same type under one name. Each item has an index.

Arrays: 1D and 2D

What you'll explore

Why arrays?: One name instead of many
An array stores many values of the same type under one name. Each item has an index.
Indexing: Pick one item
Use an index to read one item. Move the index.
Looping through an array: Visit every item
A FOR loop with the index as its counter visits every element. Step through.
2D arrays: Rows and columns
A 2D array is a table. scores[row, col] picks one cell. Move the sliders, then show row totals with nested loops.
Check yourself: 2D index
scores[2, 0] in the table: row 2 is Chidi, column 0 is T1.

Also in this lesson

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

Words to know

Array
A data structure holding many values of one type under one name.
Element
One item in an array.
Index
The position number of an element.
2D array
An array with rows and columns.
Nested loop
A loop inside another loop.

Sources

  • Python documentation: Lists
  • Raspberry Pi Foundation, Isaac Computer Science: arrays
  • BBC Bitesize, GCSE Computer Science: arrays
  • Khan Academy: arrays in programming

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

← Strings and nested selection · Linear search and bubble sort →

All lessons in Term 3 · Computing · Age 14