Find minimum number of coins that make a given value: Difference between revisions
Find minimum number of coins that make a given value (view source)
Revision as of 05:10, 9 August 2021
, 2 years agouse divmod
m (added a requirement to this (draft) task to show the results here on this page, added whitespace and verbiage.) |
m (use divmod) |
||
Line 153:
coins, remaining = sorted(denominations, reverse=True), total
for n in range(len(coins)):
coinsused, remaining = divmod(remaining
if coinsused > 0:
print(" ", coinsused, "*", coins[n])
|