Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # #!/usr/bin/python
- #
- # By dvdjaco
- # Exercise 3.1
- #
- # Rewrite your pay computation to give the employee 1.5 times the hourly rate for
- # hours worked above 40 hours.
- prompt_hours = 'Please enter the number of hours: '
- prompt_rate = 'Please enter the hourly rate: '
- hours = float(raw_input(prompt_hours))
- rate = float(raw_input(prompt_rate))
- if hours > 40:
- gross_pay = (40.0 + (hours - 40) * 1.5) * rate
- else:
- gross_pay = float(hours) * float(rate)
- print 'The gross pay is ' + str(gross_pay)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement