I have been trying to fix this issue but in the task, for pset6 it says that you need to test the code you wrote with some values it works for some of them but for the rest, it doesn't work I am not sure why.
so the image below is the values that I need to try the code I wrote works for the first 3 inputs but after 0.15 the values like 1.60, 23, and 4.2 does not work I am not sure why
from cs50 import get_float
coin_count =0
change = get_float("Enter Change Amount: ")
total_amount = round(change * 100);
coin_amounts = [25,10,5,1]
while change<=0:
change = get_float("Enter Change Amount: ")
while total_amount > 0:
for i in coin_amounts:
if total_amount >=i:
total_amount -= i
coin_count+=1
print(str(coin_count) + " coins");
question from:
https://stackoverflow.com/questions/65623363/cs50-pset6-cash-py-not-showing-the-proper-amount-of-coins-needed 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…