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 create a game using two-dimensional lists.

      Key learning points

      1. A two-dimensional list allows you to hold a list as one element.
      2. Data in a 2D list can be held in rows and columns.
      3. A 2D list can be used to create a game board.

      Keywords

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

      • Subroutine - a sequence of instructions with an identifiable name that performs a specific task

      Common misconception

      You cannot print a game board or table layout neatly in Python.

      You can added spaces and | to format a game board or table in Python.

      Teacher tip

      This lesson requires knowledge of coordinates of items in 2D arrays.

      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.
      A 2D list is a list that contains other , allowing us to store data in a row and column format.

      Correct Answer: lists

      Q2.
      What will be the output of this subroutine?
      1234
      def greet(name): return "Hello, " + name + "!" print(greet("Alice"))
      Code colour

      greet("Alice")
      Correct answer: `Hello, Alice!`
      "Hello, Alice!"

      Q3.
      Match the concept to the definition

      Correct Answer:list,a collection of values stored in a single variable

      a collection of values stored in a single variable

      Correct Answer:2D list,a list that contains multiple lists inside it

      a list that contains multiple lists inside it

      Correct Answer:subroutine,a function or procedure that performs a task

      a function or procedure that performs a task

      Q4.
      Which of the following correctly defines a subroutine in Python?

      def myFunction:
      function myFunction():
      Correct answer: `def myFunction():`
      subroutine myFunction():

      Q5.
      What will be the output of the following code?
      12
      my_list = [10, 20, 30, 40] print(len(my_list))
      Code colour

      3
      Correct answer: 4
      5

      Q6.
      A list can contain mixed , e.g. [1, "hello", 3.14]

      variables
      Correct answer: data types
      strings
      integers

      6 Questions

      Q1.
      What is a two-dimensional list?

      a list with only one row of values
      Correct answer: a list that has both columns and rows of values
      a function in Python that creates lists automatically
      a list containing only numbers

      Q2.
      In Python, how would you access the element in the third row and second column of a 2D list named 'board'?

      Correct answer: `board[2][1]`
      board[1][2]
      board[3][2]
      board[2,1]

      Q3.
      What is the purpose of the int() function when taking user input for coordinates in the game?

      It converts the input into a string.
      It strips out spaces from the input.
      It randomly generates coordinates.
      Correct answer: It converts the input into a number.

      Q4.
      Which statement correctly updates the user_board by placing an ‘X’ in row 1, column 3?

      user_board[3][1] = "X"
      Correct answer: `user_board[0][2] = "X"`
      user_board[2][4] = "X"
      user_board[3][2] = "X"

      Q5.
      A list is a list that contains other lists, allowing data to be organised in rows and columns.

      Correct Answer: 2D, two-dimensional, two dimensional

      Q6.
      What will be the output of the following code?
      12
      grid = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] print(grid[1][2])
      Code colour

      2
      4
      Correct answer: 6
      9

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