lesson
Check the input before acting
1 · Learn
A program can use an input such as a button press or a sensor reading to make a decision. A model light display might turn on an indicator if a measured light level is below a chosen threshold.
The threshold and units depend on the device. A low reading can also result from a covered or faulty sensor. Test the setup rather than treating every input as perfect.
2 · Worked example
I use an approved simulator with invented light readings. I test values just below, at and above the threshold to confirm the indicator's behaviour.
3 · Your turn
Why should a program's threshold be checked against the sensor's actual scale?
Check your answer
Different sensors can use different units or ranges, so a copied number may not represent the intended condition.
4 · Apply your learning
Use a school-approved simulator or supervised educational device to control a safe on-screen output from an input condition.
Adult guidance and safety
Use adult-approved offline or school-managed tools, invented data and original media. Keep projects private unless sharing is explicitly approved. Paper traces support, but do not replace, practical programming and saved digital work. No real passwords or personal records belong in these exercises.
Open your writing and drawing pad
Write, draw or show your working. Use a mouse, pen or finger. This pad is not a submitted answer.
Not saved to your account. Download your drawing as PNG and your typed notes as TXT before leaving or refreshing. They are separate files. Do not enter private information.
Open a picture saved on this device to draw on it again. Opening replaces the drawing, but Undo can restore it. PNG only, up to 4 MB and 4096 × 4096 pixels. The picture stays in this browser; it is not uploaded. Paper lines in a saved picture become part of that picture.
Clear the drawing? Your typed notes will stay. You can undo this action.
Your pad is empty.
Open a UTF-8 TXT file from this device, up to 40 KB and 10,000 characters. It stays in this browser. Opening can be undone until you type again. Downloads keep a new copy; they do not change the file you opened.
Replace the notes on this page with the opened file? Download the current notes first if you want to keep them.
Typed notes are not submitted answers.
Check a calculation · Year 5 onward
Use this only when your teacher or adult allows a calculator for the task. Show your thinking first. It does not replace mental or written arithmetic and does not mark your lesson answer.
Practice this lesson
Lesson resources
Browse the available practice activities and worksheets for this lesson.
Your progress