Skip to content

Commit

Permalink
Added LDL
Browse files Browse the repository at this point in the history
  • Loading branch information
SiyuZhou918 committed Jan 31, 2023
1 parent 319c343 commit ae2539c
Showing 1 changed file with 55 additions and 13 deletions.
68 changes: 55 additions & 13 deletions blood_calculator.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
def interface():
print("Blood calculator")
keep_running = True
keep_running = True
while keep_running:
print("Options:")
print("1 - HDL")
print("2 - LDL")
print("3 - Total Cholesterol")
print("9 - Quit")
choice = input("Select an option:")
if choice == "9":
keep_running = False
elif choice == "1":
HDL_driver()
elif choice == "2":
LDL_driver()
elif choice == "3":
total_driver()
print("Program ending")


def HDL_driver():
HDL_in = HDL_input()
HDL_in = generic_input("HDL")
HDL_analy = HDL_analysis(HDL_in)
HDL_output(HDL_in, HDL_analy)

def HDL_input():
HDL_value = input("Enter the HDL result:")
HDL_value = int(HDL_value)
return HDL_value
generic_output("HDL", HDL_in, HDL_analy)


def generic_input(test_name):
value = input ("Enter the {} value: ".format(test_name))
value = int(value)
return value


def HDL_analysis(HDL_int):
if HDL_int >= 60:
answer = "Normal"
Expand All @@ -31,11 +39,45 @@ def HDL_analysis(HDL_int):
else:
answer = "Low"
return answer


def generic_output(test_name, test_value, test_analy):
print("The {} result of {} is considered {}"
.format(test_name, test_value, test_analy))
return


def HDL_output(HDL_value, HDL_analy):
print("The HDL result of {} is connected {}".format(HDL_value, HDL_analy))
return
def LDL_driver():
LDL_in = generic_input("LDL")
LDL_analy = LDL_analysis(LDL_in)
generic_output("LDL", LDL_in, LDL_analy)

def LDL_analysis(LDL_int):
if LDL_int >= 190:
answer = "Very High"
elif 160 <= LDL_int < 190:
answer = "High"
elif 130 <= LDL_int < 160:
answer = "Borderline High"
else:
answer = "Normal"
return answer

interface()
def total_driver():
total_in = generic_input("Total Cholesterol")
total_analy = total_analysis(total_in)
generic_output("Total Cholesterol", total_in, total_analy)

def total_analysis(total_int):
if total_int >= 240:
answer = "High"
elif 200 <= total_int < 240:
answer = "Borderline High"
else:
answer = "Normal"
return answer




interface()

0 comments on commit ae2539c

Please sign in to comment.