Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Coins-changed to elif/else

JOHNYTHEWINNER Mar 8th, 2020 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. money = float(input())
  2. money *= 100
  3. coins = 0
  4. while money > 0:
  5.     if money >= 200:
  6.         coins += money // 200
  7.         money %= 200
  8.     elif money >= 100:
  9.         coins += money // 100
  10.         money %= 100
  11.     elif money >= 50:
  12.         coins += money // 50
  13.         money %= 50
  14.     elif money >= 20:
  15.         coins += money // 20
  16.         money %= 20
  17.     elif money >= 10:
  18.         coins += money // 10
  19.         money %= 10
  20.     elif money >= 5:
  21.         coins += money // 5
  22.         money %= 5
  23.     elif money >= 2:
  24.         coins += money // 2
  25.         money %= 2
  26.     else:
  27.         coins += money // 1
  28.         money = 0
  29.  
  30. print(f"{coins:.0f}")
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