Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 correct. image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Decisions Based On Data Analytics For Business Excellence

Authors: Bastian Weber

1st Edition

9358681683, 978-9358681680

More Books

Students also viewed these Databases questions

Question

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago