I am building a python vending machine program where you input price and get change due. Ive got the price working fine and the change for the most part, but Im trying to figure out how to give exact change. Im using dollars, quarters, dimes, nickels and pennies. I am trying to stop it from giving incorrect change when I put in a number that is not even in quarters. For example if I put in 5 dollars for my bill and 260 for the price (im only up to dimes at this point) It tells me that I will get 2 dollars, 1 quarter, and 4 dimes. I still need to add nickels and pennies, but how do I stop it from doing this. I know there are a whole bunch of different ways to give 40 cents change back, but I need it to be precise.
pippy729 0 Newbie Poster
Reverend Jim 4,968 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
rproffitt 2,662 "Nothing to see here." Moderator
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.