Grid Warning Report

P5 · Functions & 2D Lists

Difficulty 5/544 XP~20 min
A
6 marksOCR J277 · 2.2.1 Programming fundamentalsCommand word: Write a programJ277/02 Computational thinking
Step 1 of 6Grasp the problem

Understand — Grasp the problem

Read the scenario carefully and identify exactly what the question asks you to produce.

We have 6 sensor readings arranged in a 2 × 3 grid. We need to count how many readings are greater than the warning threshold.

Example

Let's try one together.

Threshold = 14

Which readings are above 14?

Click on the numbers that are above the threshold.

Tap the readings above the threshold.

Peek ahead

Here's what we'll build

def count_above(grid, threshold):
count = 0
for row in grid:
for reading in row:
if reading > threshold:
count += 1
return count

Python idea we'll use

We will use the greater than operator > to check if a number is above the threshold.

if reading > threshold:
count += 1

This means: if reading is greater than threshold, then increase count by 1.

Challenge progress

Understand the problem

Learn the Python idea

Plan the solution

Write the code

Test your code

Submit and complete

Exam Coach

Ages 14–16

Make sure you understand the mission using a simple example.

Exam skill focus

Complete this challenge

1/6

You'll learn

How to use a function

How to work with 2D lists

How to count using a condition

Still not sure?

Watch this 60 second explanation

Watch now →

Stuck?

You can ask for a hint at any time.

Step 1 of 6