Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # P2PU - Python Programming 101 - Chapter 8 - Functions
- # Python for Informatics - Chapter 4 - Functions
- # Exercise 4.6
- def computepay(hours, rate):
- pay = hours * rate
- if hours > 40 : pay = pay + (hours - 40) * rate * 0.5
- return round(pay,2)
- try:
- h = float(raw_input('Enter Hours: '))
- r = float(raw_input('Enter Rate : '))
- except:
- print 'Error, please enter numeric input!'
- exit()
- print 'Pay:', computepay(h,r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement