Skip to content

Instantly share code, notes, and snippets.

@rodamber
Created October 9, 2016 18:21
Show Gist options
  • Save rodamber/1c2b35313453474b805683af5af23454 to your computer and use it in GitHub Desktop.
Save rodamber/1c2b35313453474b805683af5af23454 to your computer and use it in GitHub Desktop.
moneys = [50, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05, 0.02, 0.01]
def ex5(quantity):
quantities = {m: 0 for m in moneys}
for m in moneys:
while quantity >= m:
quantity -= m
quantities[m] += 1
return quantities
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment