Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.
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))