Answer to Question #275491 in Python for Sargun

Question #275491

Python code to input 10 values and get the average temperature of a patient. if the average temperature value is in between 97 Fahrenheit and 99 Fahrenheit then display the message “Your body temperature is normal...”. If it is more than 100.40 Fahrenheit then display the message “You have a fever caused by an infection or illness...”.




1
Expert's answer
2021-12-04T10:19:02-0500
# Python 3.9.5

import statistics
from statistics import mean

counter = 0
tmp_list = []
while True:
    tmp = float(input('Enter temperature: '))
    tmp_list.append(tmp)
    counter += 1
    if counter == 10:
        average_tmp = statistics.mean(tmp_list)
        print('Average temperature: ', average_tmp)
        if average_tmp < 97:
            print('You have to keep warm')
        elif 97 <= average_tmp <=99:
            print('Your body temperature is normal')
        elif 100.4 > average_tmp > 99:
            print('You may have health problems')
        elif average_tmp > 100.4:
            print('You have a fever caused by an infection or illness')
        break

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS