- My denomination "5" is not showing up and how do you reverse the dict easily. i dont want extra 5 line of code.lol
- Can you guys help me out with it?
the code is working so far.
here is my code with a test case
def change(target, coins): result = dict() i= len(coins) -1 while i> 0: coin = coins[i] numOfThisCoin= target // coin result[coin] = numOfThisCoin target -= coin * numOfThisCoin i-= 1 return result print(change(185, (5, 10, 25, 100, 200)))
i am getting output
{200: 0, 100: 1, 25: 3, 10: 1}
but want it like
{5: 0, 10: 1, 25: 3, 100: 1, 200: 0}