Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def count_change(money, available_coins, used_coins):
- if sum(used_coins) == money:
- yield used_coins
- elif sum(used_coins) > money:
- pass
- elif available_coins == []:
- pass
- else:
- for c in change(money, available_coins[:], used_coins+[available_coins[0]]): #multiple reccurencies
- yield c
- for c in change(money, available_coins[1:], used_coins): #stop picking coins
- yield c
Advertisement
Add Comment
Please, Sign In to add comment