Choose exam board for KS4 Computer Science (GCSE)
Choose exam board for KS4 English
Choose exam board for KS4 French
Choose exam board for KS4 Geography
Choose exam board for KS4 German
Choose exam board for KS4 History
Choose tier for KS4 Maths
Choose exam board for KS4 Music
Choose exam board for KS4 Physical education (GCSE)
Choose exam board for KS4 Religious education (GCSE)
Choose exam board for KS4 Spanish

      Lesson details

      Learning outcome

      I can define and use two-dimensional lists.

      Key learning points

      1. A list is used to hold multiple elements under one name.
      2. A two-dimensional list allows you to hold a list as one element.
      3. Data in a 2D list can be held in rows and columns.

      Keywords

      • List - a dynamic data structure that can contain items of different data types

      • Two-dimensional - describes a list or array that has both columns and rows of values

      • Array - a static data structure that contains items of the same data type

      Common misconception

      Arrays and lists behave in the same way.

      An array has a predefined fixed size. A list can vary in size throughout program execution.

      Teacher tip

      Indexing in 2D lists can be difficult for pupils to understand. Perhaps draw a table with index values in a grid so students can become familiar with the indexing of the rows and columns.

      Equipment

      Pupils will need access to a device that can edit and run Python programs. Examples in this lesson use the RPF Code Editor https://oak.link/python-editor

      Licence

      This content is © Oak National Academy Limited (2026), licensed on Open Government Licence version 3.0
      except where otherwise stated. See Oak's terms & conditions
      (Collection 2).

      Lesson video

      Loading...

      Prior knowledge starter quiz

      6 Questions

      Q1.
      What does this code do?
      123
      animals = ["dog", "cat", "rabbit"] animals.insert(1, "hamster") print(animals)
      Code colour

      adds hamster to the end of the list
      replaces cat with hamster
      Correct answer: inserts hamster at index position `[1]`, shifting the other items
      inserts hamster at index position [0], replacing dog

      Q2.
      What will be the output of the following code?
      12
      colors = ["red", "blue", "green", "blue"] print(colors.count("blue"))
      Code colour

      0
      1
      Correct answer: 2
      3

      Q3.
      Which method would you use to add an item to the end of a list?

      insert()
      Correct answer: `append()`
      pop()
      remove()

      Q4.
      What does the pop() method do in a Python list?

      adds an item to the end of the list
      Correct answer: removes an item at a given index and returns it
      replaces an item at a given index

      Q5.
      What is the correct way to remove "apple" from the following list?
      1
      fruits = ["banana", "apple", "cherry"]
      Code colour

      fruits.pop("apple")
      Correct answer: `fruits.remove("apple")`
      fruits.delete("apple")
      fruits.cut("apple")

      Q6.
      A can return multiple values by placing them in a list.

      Correct Answer: function

      6 Questions

      Q1.
      What is a two-dimensional (2D) list?

      a list that can only store numbers
      Correct answer: a list that contains multiple one-dimensional lists inside it
      a list that is always empty
      a list that can only store text

      Q2.
      How do you access the value at row index 1 and column index 2 in the following 2D list?
      1234
      grades = [ ["Math", "Science", "History"], [85, 90, 78] ]
      Code colour

      grades(1,2)
      grades[2][1]
      Correct answer: `grades[1][2]`
      grades[1,2]

      Q3.
      Which of the following correctly defines a 2D list in Python?

      Correct answer: `data = [ [1, 2, 3] , [4, 5, 6] ]`
      data = ( [1, 2, 3] , [4, 5, 6] )
      data = { [1, 2, 3] , [4, 5, 6] }
      data = < [1, 2, 3] , [4, 5, 6] >

      Q4.
      What will be the output of the following code?
      12345
      table = [ ["apple", "banana", "cherry"], [3, 2, 5] ] print(table[0][1])
      Code colour

      apple
      Correct answer: banana
      2
      3

      Q5.
      The () method can be used to add a new row to a 2D list.

      Correct Answer: append, append()

      Q6.
      How can you change the value "dog" to "cat" in the following 2D list?
      1234
      animals = [ ["lion", "tiger", "dog"], ["parrot", "eagle", "owl"] ]
      Code colour

      Correct answer: `animals[0][2] = "cat"`
      animals[1][2] = "cat"
      animals[2][0] = "cat"
      animals[0][1] = "cat"

      To help you plan your 10 computer science lesson on: 2D arrays and lists, download all teaching resources for free and adapt to suit your pupils' needs...