Question: Pyhton. write code to compute the miniym, maximum, and average temperature. the code in the 2nd pic are from the temp_file_stat and read_temp_file, all are

You are interested in finding outlier temperatures and comparing them to the long run average. Start a new program temp_file_stats.py from your working version of read_temp_file.py. Comment out the line that prints print out the year and temperature for each year. Write code to compute the minimum, maximum, and average temperature from all the data in the file. Here is a transcript of how the program should work: Temperature anomaly filename:NorCal-188 Analyzing NorCal-1880-2018.csv Min temp: -2.32 Max temp: 2.99 Ave temp: -0.15956834532374103 while True: temp=input("Temperature anomaly filename: ") try: #check valid input or not infile=open(temp,"r") print("Analyzing", temp) break except : print("Could not open ", temp) #again reading input #exiting the while loop #ignore the first five lines for i in range (5): #ignore 5 line 0 1 2 3 4 infile.readline() for line in infile: line-line.strip() year, value=line.split(',') value=float(value) print (year, value) close. infile()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
