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

      Programming project - Sense HAT II

      Lesson details

      Learning outcome

      I can randomly generate pixel colours and use this to create a fortune-telling ball.

      Key learning points

      1. Static data structures reserve memory locations for a set amount of data. Their size cannot change.
      2. Dynamic data structures are more flexible. The memory capacity is not fixed.
      3. The choice() function can be used to randomly choose an item from a list.
      4. For example, it could randomly pick a pixel from a list storing all pixels in an LED matrix.

      Keywords

      • Append - add to an existing data structure

      • Pixel - a single element of an image on a computer screen

      Common misconception

      A list is static, so once it is created it cannot be edited or amended.

      A list is a dynamic data structure that can change in size. The append() function can be used to add elements to a list.

      Teacher tip

      If pupils have access to the physical devices of the Raspberry Pi computer and Sense HAT for this lesson, instructions on how to set up this hardware are included as an additional resource for this lesson.

      Equipment

      Pupils need access to a device that can edit and run Python programs and optionally a RPi computer with Sense HAT. 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 is the main advantage of using the Sense HAT emulator?

      Correct answer: You can practise coding without the physical hardware.
      It makes the Raspberry Pi lighter.
      It increases battery life.
      It prints your code.

      Q2.
      Which of these is a feature of the Sense HAT?

      built-in printer
      touch screen
      Correct answer: LED matrix for displaying colours
      wireless charging

      Q3.
      Why might you use a list when working with the LED matrix?

      to save internet data
      to adjust the volume
      to store passwords
      Correct answer: to control the colour of every pixel

      Q4.
      What is the part of the Sense HAT that detects things like temperature or movement?

      Correct Answer: sensor

      Q5.
      Match each action to what it does, to complete the sentences:

      Correct Answer:Importing the library ...,... lets you use hardware in code.

      ... lets you use hardware in code.

      Correct Answer:Using a list ...,... controls pixel colours.

      ... controls pixel colours.

      Correct Answer:Running code ...,... executes instructions.

      ... executes instructions.

      Correct Answer:Using the emulator ...,... tests your program digitally.

      ... tests your program digitally.

      Q6.
      What does the HAT stand for in SenseHAT?

      Correct answer: Hardware Attached on Top
      High Accuracy Tracker
      Heat and Temperature
      Hardware Automation Tool

      6 Questions

      Q1.
      What is the name for the smallest single part of an image on a computer screen?

      Correct Answer: pixel

      Q2.
      What statement describes a static data structure?

      It can grow or shrink as needed.
      Correct answer: Its size cannot change after it is created.
      It stores only numbers.
      It is always empty.

      Q3.
      What function would you use to add an item to a list in Python?

      Correct Answer: append()

      Q4.
      Which statement about lists in Python is true?

      Lists are always static and cannot be changed.
      Lists cannot use append().
      Lists are only for numbers.
      Correct answer: Lists are dynamic and can change size.

      Q5.
      Match each action to its description:

      Correct Answer:using `append()`,adds to a list

      adds to a list

      Correct Answer:using `choice()`,picks an item at random

      picks an item at random

      Correct Answer:creating a static array,fixed size

      fixed size

      Correct Answer:creating a dynamic list,flexible size

      flexible size

      Q6.
      Put these steps in order to add a new item to a list:

      1 - create a list
      2 - use append() to add an item
      3 - the list gets bigger
      4 - print the list

      To help you plan your 10 computer science lesson on: Programming project - Sense HAT II, download all teaching resources for free and adapt to suit your pupils' needs...