Unit 2 Task 1 - Solution

Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.

Solution - Task 1: Running total at the bake sale

← Back to task


One possible program:

total = 0.0

while True:
    amount = float(input("Enter payment (0 to finish): "))
    if amount == 0:
        break
    total += amount

print("Sum is:", total)