Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. coins = [25, 10, 5, 1]
  2.  
  3. def num__of_coins(cents):
  4. if cents == 0:
  5. return 0
  6. numOfCoins = 0
  7. while cents > 0:
  8. for coin in coins:
  9. if cents >= coin:
  10. cents -= coin
  11. numOfCoins += 1
  12. break
  13. return numOfCoins
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement