CHAPTER 09 VISUAL LAB - See accumulation and the reset fault
Book boards: 09a and 09b

PRACTICE ROUTINE
Cover the board answer. Predict aloud, try the example, compare with the
stated result, change one input, and try again. Explain a discrepancy
before changing another thing. All marketing examples are fictional.

Use boards 09a and 09b. Open walkthrough.py in Thonny and press F5.

EXPECTED OUTPUT
300
420
620
Finished: 620
Reset inside loop: 200

FOLLOW THE CODE
The first loop starts total once and preserves it between visits. The second
starts broken_total again on every visit, so earlier costs are discarded.
Its final output is the last cost. Both loops execute successfully; only
the first implements the request to total all costs.

CHANGE, PREDICT, CHECK
In a practice copy, append 90 to the costs list. Predict the complete output.
Answer: the first loop adds an intermediate 710 and finishes at 710. The
second loop finishes at 90 because it still forgets every previous item.

TEST THE REPAIR
Move broken_total = 0 above its for line and remove the inside reset. With
the original list, both totals should be 620. With a single cost [300], even
the faulty version would have printed 300; that input alone cannot expose
this mistake. Explain why a multi-item test matters.

For the empty-list case, initialise any final printed total before the loop.
The complete reference python/chapter09.py also collects selected values and
counts costs above a limit. Read its indentation to identify repeated work.
