Create Empty List Python Program Allows User Enter Series Temperatures Evaluate Temperatur Q37141872

I have to create an empty list in a python program that allows auser to enter a series of temperatures then I have to Evaluate thetemperature list to determine the largest and smallesttemperature.

How do I evaluate the temperature list to determine the largestand smallest temperature?


Solution


temp=[]
n=int(input(“enter the no. of temperature series: “))
print(“enter temperatures”)
for i in range (n):
x=float(input())
temp.insert(i,x)
i+=1
print(“the temperature series is:”,temp)
print(“highest temperature:”,max(temp))
print(“lowest temperature”,min(temp))

Output:

enter the no. of temperature series: 5
enter temperatures
34.6
45
42
27.9
56.7
the temperature series is: [34.6, 45.0, 42.0, 27.9, 56.7]
highest temperature: 56.7
lowest temperature 27.9

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.