So guys, I have a funky error going on and I'm wondering if you could help me out. I have a function that's supposed to find the way to give change using the least coins.
def change_counter(cost, paid):
changefor = paid - cost
and i have a a variable, changefor which is basically how much money you need to make change for. Then I declared some variables, penny = 0 and such that track how many of each coin are being given out. Then I made a while loop, that cycles until changefor hits zero.
while(changefor > 0):
if changefor >= 100:
changefor - 100
++hundreddollar
elif,etc
The rest is really self explanatory, and just printing the amounts of each coin used, etc. Does anyone see what could be causing a problem? I get a return value of -1, and nothing from the while loop seems to be doing anything.