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...”.
# 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
Comments
Leave a comment