Nov-14-2018, 03:30 AM
You need a loop, starting with the amount and the coin counts (a list like [0, 0, 0, ..., 0]). Make it a while loop (
There's a simpler way to do this without the if clauses, but let's see if you can get the if clauses working first.
while amount:
). Each time through the loop, use the if clauses to figure out the largest coin that can still be used (the coin value is less than amount). Once you find that value, add one to the count for that coin, and subtract that coin value from amount.There's a simpler way to do this without the if clauses, but let's see if you can get the if clauses working first.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures