Start with the input that makes the problem visible
A function works for one input and fails for another. Seeing the source, input and result together gives a programming lesson something concrete to investigate.
A learner can share their editor and reproduce the behaviour on their own computer. Discuss the expected result, inspect the relevant values and repeat the same case after a change.
A small example with an unresolved contract
def average(values):
return sum(values) / len(values)| Input | Current result |
|---|---|
[2, 4, 6] | 4.0 |
[] | ZeroDivisionError |
