Advertisement
Guest User

Untitled

a guest
May 11th, 2012
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. # P2PU - Python Programming 101 - Chapter 8 - Functions
  4. # Python for Informatics - Chapter 4 - Functions
  5. # Exercise 4.6
  6.  
  7. def computepay(hours, rate):
  8.    pay   = hours * rate
  9.    if hours > 40 : pay = pay + (hours - 40) * rate * 0.5
  10.    return round(pay,2)
  11.    
  12. try:
  13.    h = float(raw_input('Enter Hours: '))
  14.    r  = float(raw_input('Enter Rate : '))
  15. except:
  16.    print 'Error, please enter numeric input!'
  17.    exit()
  18.    
  19. print 'Pay:', computepay(h,r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement