This is my code:
cost = float(input("How much was the cumulative cost?\n"))
amount_given = float(input("How much did the customer give you?\n"))
change = amount_given - cost
possible_change = [5, 2, 1, 0.50, 0.20, 0.10]
change_to_give = []
for i in possible_change:
while cost >= i:
change = change - i
change_to_give.append(i)
print(change_to_give)
The main issue I seem to be coming across is that the change variable ends up with a very peculiar number often many decimal places long.
I've probably made a silly mistake but I just can't seem to find it!