misconception: An idea that leads to repeated wrong answers; counterexample: One example that shows a claim is false; retest: Check again after a change
55-minute lesson sequence
0–5 · Answer the retrieval alone. Compare one reason.
5–15 · Teacher models the example. Students predict each next step.
15–40 · Build, trace and test the main tasks. Work alone first; compare after a checkpoint.
40–50 · Check results. Explain a test and repair one error. Use the extension only if ready.
50–55 · Complete the exit alone. Save the evidence for the next lesson.
Try before notes
A learner says format(256, "08b") must have eight digits. Give a counterexample result.
Build the idea
Use the feedback target to choose a route, not to repeat everything equally. A useful repair states the earlier wrong idea, supplies a counterexample and explains the corrected rule.
Separate multiple bugs. A counter may have both an equality error and an early return. Fixing one can leave the other. Design different tests that reveal different causes.
After repair, use a fresh input rather than replaying only the example used to write the fix. Keep enough trace to explain why it now works and what assumptions remain.
bug A → equality test
bug B → later-item test
repair both → rerun all tests
See the method
Claim: A file line containing 25 is already an integer. Counterexample: reading the line gives text such as "25\n". int(line.strip()) gives integer 25. Repair the explanation and code; then test a different line such as "31\n". The new result should be integer 31.
Predict then reveal
A count-at-least function uses > and returns after its first loop iteration. Suggest two inputs at limit 7 that reveal different faults.
Reveal reasoning
[7] should count 1; a > condition gives 0, revealing equality. [3,9] should count 1; early return after 3 gives 0, revealing missed later items. Test both after each repair.
A line read from a file is "42\n". Explain the complete conversion path without saying it is already a number.
Reveal reasoning
Reading gives a string containing characters 4,2 and newline. strip gives string "42". int converts that valid integer text to numeric 42. Then arithmetic uses the integer.
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
Use your feedback target. First answer the matching route alone. Route A: convert decimal 109 to eight-bit binary and hex; explain whether 256 fits. Route B: for F=A AND NOT B, write outputs for 00, 01, 10, 11. Route C: explain PC versus IR and MAR versus MDR. Then explain the cause of one earlier error.
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
Use your feedback target. First answer the matching route alone. Route A: convert decimal 109 to eight-bit binary and hex; explain whether 256 fits. Route B: for F=A AND NOT B, write outputs for 00, 01, 10, 11. Route C: explain PC versus IR and MAR versus MDR. Then explain the cause of one earlier error.
Repair this function. It must count all values at least limit, including equality. Predict the faulty output for [20, 30] at 25. Then test your repaired function on [], [25], [20, 30].
def count_high(values, limit):
total = 0
for value in values:
if value > limit:
total = total + 1
return total
Record one before-and-after example. State the changed idea or code line and why it solves the cause.
Check and explain
Two failures with the same output can have different causes. Use tests that isolate them.
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
Which fresh test will you use tomorrow to show the fix stayed fixed?
HL challenge when ready
What does the faulty function return for []? Explain.
Week 9 homework
Show working. Keep code and output. Stop at 25 minutes and mark where you reached.
Complete this homework before Friday 15 January. Trace sum_from([2, 5], 0), using the lesson 9.3 function. Give call indices, base return, final result and total calls.
For a queue initially [A, B, C], serve one item from the front and add D to the back. State the served item and the queue after both actions. Explain FIFO in one sentence.
Prepare your four evidence items for lesson 9.5. Name one item you will explain, the input or question, and the correct output or conclusion. Do not create a long new report.
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
Repair an accumulator that incorrectly starts at one. Explain the effect on every result.
No imports needed.
Hint and starter code
An accumulator stores a running total; choose its starting value from the operation.
# An accumulator stores a running total; choose its starting value from the operation.
def total(values):
result = 1 # Your turn: repair initial value
for value in values:
result += value
return result
print(total([2, 3]), total([]))