Advertisement
Guest User

Untitled

a guest
Sep 27th, 2011
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. # Exercise 4.6
  2.  
  3. def computepay(hrs, rate):
  4.     if hrs >= 40:
  5.         pay = (40 * rate) + ((hrs - 40) * rate * 1.5)
  6.     else:
  7.         pay = (hrs * rate)
  8.  
  9.     return pay
  10.  
  11. try:
  12.     hrs = float(raw_input('How many hours did you work this week? \n'))
  13.     rate = float(raw_input('What is your rate? \n'))
  14.    
  15. except:
  16.     print 'Please enter a number. \n'
  17.     quit()
  18.  
  19. print 'Pay: \n', computepay(hrs, rate)
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement