-
Notifications
You must be signed in to change notification settings - Fork 1
/
calculator.py
62 lines (51 loc) · 1.54 KB
/
calculator.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
def check_HDL(HDL_result):
if HDL_result >= 60:
return "Normal"
elif 40 <= HDL_result < 60:
return "Borderline low"
else:
return "low"
def check_LDL(LDL):
if LDL < 130:
return "Normal"
elif 130 <= LDL <= 159:
return "Borderline high"
elif 159 < LDL <= 189:
return "High"
else:
return "Very High"
def check_TLC(TLC):
if TLC < 200:
return "Normal"
elif 200 <= TLC <= 239:
return "Borderline high"
else:
return "High"
def cholestoral_interface():
print("Cholesterol check")
chol_input = input("Enter your cholesterol test result: ")
chol_data = chol_input.split("=")
if chol_data[0] == "HDL":
result = check_HDL(int(chol_data[1]))
print("The HDL cholesterol level is {}.".format(result))
elif chol_data[0] == "LDL":
results = check_LDL(int(chol_data[1]))
print("The LDL cholesterol level is {}.".format(results))
elif chol_data[0] == "TLC":
results = check_TLC(int(chol_data[1]))
print("The total cholesterol level is {}.".format(results))
def interface():
print("My calculator program")
keep_running = True
while keep_running:
print("Option: ")
print("1 - Cholesterol Checks")
print("9 - Quit")
choice = input("Enter your choice: ")
if choice == '9':
keep_running = False
elif choice == '1':
cholestoral_interface()
return
if __name__ == "__main__":
interface()