-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBiggerthan2.py
72 lines (46 loc) · 1.42 KB
/
Biggerthan2.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
def validate_numbers(hours, rate):
validation = False
try:
hours = float(hours)
rate = float(rate)
pay = hours*rate
valiate = True
except:
hours = raw_input('Enter Hours as a number :')
rate = raw_input('Enter Rate as a number :')
hours = float(hours)
if (hours > 0 and rate > 0 ) :
validate = True
print ' Nice work, your hours and rate is stored as :', hours, rate
else:
print ' hours and rate is not put in as a number'
return validation
def overtime(hours, rate) :
overtime = 0
validate = validate_numbers(hours, rate)
hours = float(hours)
rate = float(rate)
if (hours > 40 ):
overtime = hours - 40.0
overtime = overtime * rate * 1.5
else:
print 'No overtime payment achieved'
return overtime
def computepay (hours, rate) :
pay = 0
if (hours >= 40):
pay = 40 * float(rate)
pay = pay + float(overtime (hours,rate))
else:
pay = hours * rate
return pay
while True:
print "Let's compute your pay "
hours = raw_input('Enter Hours :')
rate = raw_input('Enter Rate :')
pay = -1.0
print 'Pay :', computepay(hours, rate)
line = raw_input('Write Done if you want to quit and Con if you want to run the script again : ')
print "Let's quit: ", line
if(line=='Done'):
break