Answer to Question #273062 in Python for sam

Question #273062

A group of medical students were monitoring the body temperature of a patient daily basis. Students captured 10 temperature readings in Celsius on a particular day.


1. Write an Algorithm to input these ten values and get the average temperature for that day. if the average temperature value is in between 970 Fahrenheit and 990 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…”.


2. Convert the above algorithm (written in part (1)) to a Python program to output the desired results


1
Expert's answer
2021-11-29T02:46:42-0500


Algorithm 


Start
   Declare list temperatures[]
   Declare variable averageTemperature
   for i=1 to 10 do
        Read temperature
        add temperature to temperatures list
   Set averageTemperature=sum(temperatures)/10.0
   if averageTemperature>=970 and averageTemperature<=990 then
       print "Your body temperature is normal…"
   else if averageTemperature>=100.40 and averageTemperature<970 then
        print "You have a fever caused by an infection or illness…"
   else
        print "Wrong average temperature"
   end if
Stop


Python program


temperatures=[]
#input these ten values and get the average temperature for that day.
for i in range(1,11):
    temperatures.append(float(input(f"Enter the temperatures {i}: ")))
averageTemperature=sum(temperatures)/10.0
#if the average temperature value is in between 970 Fahrenheit and 990 Fahrenheit then display the message "Your body temperature is normal…".
if averageTemperature>=970 and averageTemperature<=990:
    print("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…".
elif averageTemperature>=100.40 and averageTemperature<970:
    print("You have a fever caused by an infection or illness…")
else:
    print("Wrong average temperature")

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