Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- coins = [25, 10, 5, 1]
- def num__of_coins(cents):
- if cents == 0:
- return 0
- numOfCoins = 0
- while cents > 0:
- for coin in coins:
- if cents >= coin:
- cents -= coin
- numOfCoins += 1
- break
- return numOfCoins
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement