2022-04-17

How to print multiple lines of input given from a while loop?

For a bit of context, the user enters patient number, and 3 body temps, and then those 3 temps are averaged and a diagnosis is given. Problem is I cannot get all of the inputs to be printed and not sure how to fix it.

average = 0
total_patient = 0
total = 0
i = 0
fever = 0 
chilled = 0 
avg_list = []
PT_list = {}
diagnosis = ('')
print()    
print('Enter patient number and three temperature readings')
print('Enter blank line to stop entering data')
patient = input('Enter patient: ')
while patient != '':
    avg_list = patient.replace(',', ' ') 
    if patient != ('\n'):
        total_patient += 1
    total = avg_list.split()
    average = (float(total[1]) + float(total[2]) + float(total[3])) / 3
    patient = input('Enter patient: ') 
    PT_list[i] = total[0], average, diagnosis
print()
print('PT      AVG      Diagnosis')
for num in PT_list:
    if average > 98.7:
        diagnosis = ('fever')
        fever += 1
    elif average < 95.0:
        diagnosis = ('chilled')
        chilled += 1
    else:
        diagnosis = ('')         
    print(total[0], '  ', round(average, 2), '   ', diagnosis)


No comments:

Post a Comment