Unit 2 Task 11 - Solution

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

Solution - Task 11: Strawberry stand checkout

← Back to task


One possible program:

cost = float(input("Enter the cost: "))
money = float(input("Enter money from customer: "))

while money < cost:
    print("No sale")
    money = float(input("Enter money from customer: "))

if money == cost:
    print("Thank you for your payment")
else:
    change = round(money - cost, 1)
    print("Your change is: $" + str(change))