Lesson details

Key learning points

  1. In this lesson, we will learn about 2D arrays and lists. We will discover new syntax for creating and using them in our programs.

Licence

This content is made available by Oak National Academy Limited and its partners and licensed under Oak’s terms & conditions (Collection 1), except where otherwise stated.

Loading...

3 Questions

Q1.
What are the three possible outputs from this program when it is executed? [SELECT THREE]
An image in a quiz
Correct answer: All pixels will be blue
Correct answer: All pixels will be red
All pixels will be switched off
Correct answer: All pixels will be yellow
Each pixel in the grid will be a random colour from a choice of red, yellow or blue
Q2.
Which of these is the correct import statement for importing the sense hat module?
from sense_hat import sensehat
Correct answer: from sense_hat import SenseHat
from Sense_Hat import SenseHat
from Sense_HAT import SenseHAT
Q3.
If you want a block of code to repeat forever, what statement should you use?
repeat forever:
repeat Forever:
while true:
Correct answer: while True:

3 Questions

Q1.
What will the output be when this program is executed?
An image in a quiz
Fred
Correct answer: Fred, Wilma, Dino
Fred, Wilma, Dino, 4, 5, 6
scores[0]
Q2.
If the user enters Bob when prompted, what will be the output?
An image in a quiz
{answer}'s score is {score}
5
Correct answer: Bob’s score is 5
Error: index out of range
Q3.
Is this a definition for a 2D array or a 2D list? A __________ must be a predefined fixed size and each item held must be of the same data type.
Correct answer: 2D array
2D list