coins = [1, 5, 10, 50, 100, 500] coins.sort(reverse=True) K = 4200 count = 0 for coin in coins: num = K // coin count += num K -= coin * num print(count)
To embed this project on your website, copy the following code and paste it into your website's HTML: