forked from epequeno/python-for-informatics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01.py
More file actions
35 lines (27 loc) · 808 Bytes
/
01.py
File metadata and controls
35 lines (27 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 22 14:08:58 2014
@author: Estevan Adrian Pequeno
"""
'''
Rewrite your pay computation to give the employee 1.5 times the hourly rate
for hours worked above 40 hours.
Enter Hours: 45
Enter Rate: 10
Pay: 475.0
'''
hours = float(raw_input("Enter Hours: "))
rate = float(raw_input("Enter Rate: "))
OVERTIME_RATE = 1.5
def pay(hours, rate):
''' Determine pay given hours and rate and 1.5 times the hourly
rate for hours worked above 40.'''
overtime_pay = 0
if hours > 40:
overtime_hours = hours - 40
overtime_pay = overtime_hours * rate * OVERTIME_RATE
final_pay = ((hours - overtime_hours) * rate) + overtime_pay
else:
final_pay = (hours * rate)
return "Pay: " + str(final_pay)
print pay(hours, rate)