Write a Python program that prompts the user for the cost of two items to be purchased. Then prompt the user for payment. If the amount entered is less than the total cost of the two items, print a message that states how much is still owed. Otherwise, print a thank you message and state how much change will be given.

Respuesta :

Answer:

first_item = float(input("Enter the cost of your first item: "))

second_item = float(input("Enter the cost of your second item: "))

total = first_item + second_item

payment = float(input("Enter the amount you will be paying: "))

if payment < total:

   print("You still owe: " + str(total - payment))

else:

   print("Thank you. You will receive " + str(payment - total))

Explanation:

- Get the item costs from the user

- Calculate the total

- Get the payment from the user

- Compare the payment and total and print the appropriate message