forked from pcs-jim/solbridge-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chapter3.py
49 lines (35 loc) · 834 Bytes
/
chapter3.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
# Chapter 3 Exercises
# Exercise 1
hours = float(input('Enter Hours: '))
rate = float(input('Enter Rate: '))
if hours > 40:
pay = (40.0 * rate) + ((hours - 40.0) * 1.5 * rate)
else:
pay = hours*rate
print('Pay: ', pay)
# Exercise 2
try:
hours = float(input('Enter Hours: '))
rate = float(input('Enter Rate: '))
if hours > 40:
pay = (40.0 * rate) + ((hours - 40.0) * 1.5 * rate)
print('Pay: ', pay)
except:
print('Error, please enter numeric input')
# Exercise 3
try:
score = float(input('Enter score: '))
assert (score <= 1.0)
assert (score >= 0.0)
if score >= 0.9:
print('A')
elif score > 0.8:
print('B')
elif score > 0.7:
print('C')
elif score > 0.6:
print('D')
else:
print('F')
except:
print('Bad score')