Week 9 · Lesson 2 · 55 minutes

Check the repair on a new example

Use fresh evidence to decide what still needs support.

Planned lesson. Follow your teacher’s teaching order.

Source workbook pages: 56.

Resources

Vocabulary

Vocabulary
independent: Done without someone supplying the answer; retain: Keep an idea over time; evidence point: One specific piece of understanding shown
55-minute lesson sequence
  1. 0–5 · Retrieve the purpose of a fresh test.
  2. 5–12 · Model the separate less-than boundary example and answer access questions.
  3. 12–25 · Complete the short individual theory check; apply agreed arrangements.
  4. 25–45 · Build and test the fresh counter independently, then compare with feedback.
  5. 45–50 · Name and repair one remaining gap with teacher support.
  6. 50–55 · Record an evidence-based exit and next target.

Try before notes

How can one new test help you check yesterday’s repair?

Build the idea

A fresh check asks whether a repair transfers. Close the previous solution first. Write your prediction and method before seeking feedback, so the evidence shows what you can currently do independently.

Use a small set of deliberately different tests: empty input, equality at the limit and a match after a non-match. Each test examines a particular assumption. Many similar normal cases can leave the same gap untouched.

After feedback, label a target secure now or needing another example, and attach a result. These labels describe evidence today; they are not fixed judgements about ability.

prepare → close model → independent attempt → feedback → next target

See the method

Before the independent check, practise a different boundary. For a rule value<7, tests 6, 7, 8 give True, False, False. The equality case is the key difference between < and <=. Close this example before beginning the fresh check.

Predict then reveal

Use the two fresh preparation examples, then collapse and hide this panel before the independent workbook checks. Do not show worked answers during a check.

Before the fresh check, practise a separate rule n<=5. Predict outputs for 4,5,6.

Reveal reasoning

4<=5 is True; 5<=5 is True; 6<=5 is False. Close this example before the independent check.

Why are [] and [2,8] both useful for testing a complete-list counter at limit 6?

Reveal reasoning

[] checks correct initial value and a return even when the loop runs zero times: expected 0. [2,8] checks continued processing after an initial non-match: expected 1. They test different paths.

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

  1. Fresh theory check [6 evidence points]. (a) Convert decimal 75 to eight-bit binary and hex [2]. (b) State what MAR and MDR each hold during a memory read [2]. (c) For F=A AND NOT B, give F when A, B=1, 1 and when 1, 0[2]. Work alone first; then use feedback.

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

  1. Fresh theory check [6 evidence points]. (a) Convert decimal 75 to eight-bit binary and hex [2]. (b) State what MAR and MDR each hold during a memory read [2]. (c) For F=A AND NOT B, give F when A, B=1, 1 and when 1, 0[2]. Work alone first; then use feedback.
  2. Fresh coding check [6 evidence points]. Build count_at_least(values, limit). Use a loop. Test [], [39, 40, 41] and [40] at limit 40. State expected results before running. Do not copy yesterday’s function until after your first attempt.
  3. After checking, label each target secure now or needs one more example. Support each label with a result. Fix one remaining gap with your teacher.

Check and explain

A successful empty-list test cannot detect every loop-body or progress 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

What can you now do without a model, and what evidence shows it?

HL challenge when ready

Replace the counter with a function returning the first matching index or -1. Which tests need new expected answers?

Week 9 homework

Show working. Keep code and output. Stop at 25 minutes and mark where you reached.

  1. 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.
  2. 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.
  3. 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.

Source workbook pages: 60.

Weekly homework (Word)

Python practice · two short prompts

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

Test a repaired function on values that were not used while fixing it.

No imports needed.

Hint and starter code

A fresh case can expose a repair that only worked for the original example.

# A fresh case can expose a repair that only worked for the original example.
def non_negative(value):
    return value >= 0

for value in [-7, 0, 12]:
    print(value, non_negative(value))
Open this starter in Python playground →
Prompt 2

Count passes and failures in a test result list. Add a failure and explain the change.

No imports needed.

Hint and starter code

Passing these examples is evidence, not proof for every possible input.

# Passing these examples is evidence, not proof for every possible input.
results = [True, True, False]
print("pass", sum(results))
print("fail", len(results) - sum(results))
Open this starter in Python playground →