SHARE
TWEET

Untitled

a guest Aug 25th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top