Guest User

Untitled

a guest
Jan 11th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. # constants - current U.S. currency values
  2. penny = 0.01
  3. nickel = 0.05
  4. dime = 0.1
  5. quarter = 0.25
  6. one = 1
  7. ten = 10
  8. twenty = 20
  9. fifty = 50
  10. hundred = 100
  11.  
  12. again = 'y'
  13. while again == 'y':
  14.     pennies = int(raw_input("number of pennies: "))
  15.     nickels = int(raw_input("number of nickels: "))
  16.     dimes = int(raw_input("number of dimes: "))
  17.     quarters = int(raw_input("number of quarters: "))
  18.     ones = int(raw_input("number of one dollar bills: "))
  19.     tens = int(raw_input("number of ten dollar bills: "))
  20.     twenties = int(raw_input("number of twenty dollar bills: "))
  21.     fifs = int(raw_input("number of fifty dollar bills: "))
  22.     hundreds = int(raw_input("number of hundred dollar bills: "))
  23.  
  24.     total = pennies * penny+ \
  25.         nickels * nickel + \
  26.         dimes * dime + \
  27.         quarters * quarter + \
  28.         ones * one + \
  29.         tens * ten + \
  30.         twenties * twenty + \
  31.         fifs * fifty + \
  32.         hundreds * hundred
  33.  
  34.     print 'You have a total of :', total
  35.     again = raw_input("Do you wish to continue? (y/n) ")
Add Comment
Please, Sign In to add comment