threshold: a value where the decision changes; boundary test: a test at or next to a decision limit
55-minute lesson sequence
0–5 · Retrieve actuator role.
5–15 · Predict and run the threshold model.
15–25 · Guide one normal test and draw the decision diamond.
25–45 · Students implement the validation rule and run all six boundary/fault tests.
45–50 · Inspect the None test before any comparison and discuss context-dependent safety.
50–55 · Collect the equality-test explanation.
Try before notes
Which component actually changes the room temperature?
Build the idea
A threshold rule changes its decision at a boundary. Read the comparison symbol carefully: less than excludes equality, while less than or equal includes it. Choose tests immediately below, at and above the boundary.
Predict the Boolean result before running code. Then record actual output. A successful run only shows the program ran; comparison with the expected result shows whether it met the rule.
Invalid input needs a specified response. Check for a missing value before numeric comparisons so the program does not compare None with a number. This is a simulation; real physical safety needs a separate engineered design.
In this simplified model the heater is on below 20 degrees and off otherwise. Predict before running. This is a simulation, not instructions for wiring a real heater.
A simulated cooling fan runs when temp>28. Predict results for 27,28,29.
Reveal reasoning
27>28 is False; 28>28 is False; 29>28 is True. The boundary value 28 distinguishes this rule from temp>=28.
A reading may be None. Why check temp is None before evaluating temp>28?
Reveal reasoning
None represents missing data, not a numeric temperature. Python cannot order None and 28, so the comparison raises a TypeError. Handle the missing case first, then compare valid numbers.
Work one step together
Read the first task. Each learner predicts the first step privately. Compare the method, then complete one intermediate row or one code iteration together. Do not display a finished workbook answer.
Practice
Predict and test temperatures 18,19,20,21. Record the Boolean outputs. Write an equivalent flowchart with a decision diamond and both branches.
Your turn
Complete the remaining steps of task 1 alone, then the next tasks. Predict before running code. Save your own evidence before comparing.
Practice
Predict and test temperatures 18,19,20,21. Record the Boolean outputs. Write an equivalent flowchart with a decision diamond and both branches.
Add a rule: a missing reading represented by None, or a reading outside 0–50, returns False and reports a fault. Assume every other input is numeric. Test None,-1,0,20,50,51. Explain one limit of using “heater off” as a fault response.
Check and explain
Testing only far from the threshold can miss an equality error.
Point to the first step, row, condition or requirement that supports your answer. If results differ, find the first different state and repair one cause.
Show what you know
Why test exactly 20, not only 10 and 30?
HL challenge when ready
Readings jump 19.9,20.1,19.9,20.1. What may the simple controller do?
Week 5 homework
Show working. Keep code and output. Stop at 25 minutes and mark where you reached.
Draw a closed-loop automatic door system. Label sensor, controller, actuator, controlled process and feedback. Explain one possible fault.
Trace the hysteresis rule from off for 20,18,21,22,19. Explain both exact-boundary cases.
Choose a cloud model for a team that must configure its own OS. Explain what extra work this choice brings.
Retrieve memory: why must a log be written to persistent storage if it should survive power loss?
Spend about 3 minutes on each during practice time. Predict, run, change one thing, then explain. These prompts do not add homework.
A starter is runnable code to explore or complete. If the playground restores your saved code, the linked starter is selected in Example: use Load example when ready. Download your work before confirming replacement.
Prompt 1
Complete a function that turns a fan on above a threshold. Test below, equal and above.
No imports needed.
Hint and starter code
A threshold is the boundary where a decision changes; > excludes equality.
# A threshold is the boundary where a decision changes; > excludes equality.
def fan_on(temperature):
return False # Your turn: compare with 28
for temperature in [27, 28, 29]:
print(temperature, fan_on(temperature))