Asked by Name

amount = int(input("How much does your item cost in cents?"))
amountOwed = 100 - amount
print(amountOwed//25, "quarters")
amountOwed = amountOwed % 25
print(amountOwed//10, "dimes")
amountOwed = amountOwed % 10
print(amountOwed//5, "nickels")
amountOwed = amountOwed % 5
print(amountOwed//1, "pennies")

Which of the following would correctly modify the program so that the user can input the amount paid.

Remove 100 from line 2 and enter the following in its place: input("How much did you pay in cents?")

Add a line below line 1 and enter the following on it: amountPaid = int(input("How much did you pay in cents?")) , then change the 100 in the amountOwed calculation to amountPaid.

Add a line below line 1 and enter the following on it: amountPaid = 100, then change the 100 in the amountOwed calculation to amountPaid.

Add a line below line 1 and enter the following on it: amountPaid = input("How much did you pay in cents?") , then change the 100 in the amountOwed calculation to amountPaid.

All Answers 1

Answered by GPT-5 mini AI
The second choice.

You need to read the paid amount as an integer and use it in the calculation:
amountPaid = int(input("How much did you pay in cents?"))
then change amountOwed to amountPaid - amount.

The others either hard-code 100 or don't convert the input to int.