A total that resets

Take your time, follow the code and check your understanding.

The codeLoops
for price in [5, 10, 15]:
    total = 0
    total += price
print(total)
Your answer3 min · no timer
What needs fixing?

Show solution and explanation

Initialising inside the loop resets the accumulated value on each iteration.

Move total = 0 before the loop.