Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use python. i dont understand anything so please help me. # read_temp_file.py while True: try: in_name = input(Temperature anomaly filename:) fhand = open(in_name) break except:

use python. i dont understand anything so please help me. image text in transcribed
# read_temp_file.py
while True:
try:
in_name = input("Temperature anomaly filename:")
fhand = open(in_name)
break
except:
print("Could not open",in_name)
print("Analyzing", in_name)
for i in range(5):
fhand.readline()
for line in fhand:
line = line.strip()
(year, temp) = line.split(",")
year = int(year)
temp = float(temp)
print(year,temp)
fhand.close()
above is the code and here is the pic.
image text in transcribed
this is the NorCal data
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
The first step of this analysis will be to get a window size parameter k from the user. The window size must be a positive integer no greater than 60. Start a new program temp_win1.py from your working version of read_temp_file.py from HW4. The program that reads and prints the temperature file after obtaining the filename from the user. After you have confirmed that your program is reading the temperature data from the file, you can comment out the print statement in the loop that prints the year and temperature to the screen. We have posted a solution to read_temp_file.py, if you were unable to complete it. After the program has successfully opened the file specified by the user, it will then need to obtain the window size parameter. Write a loop that asks the user for the window size parameter. Enter an integer between 0 and 60: If the user enters something that cannot be converted to an integer your program will print Enter an integer. If the user enters an integer out of range it will print Enter an integer up to 60. and you will ask for the window parameter again. Your finished program should behave as follows. Temperature anomaly filename: NorCal-1880-2018.csv Analyzing NorCal-1880-2018.csv Enter an integer between 0 and 60:spam Enter an integer. Enter an integer between 0 and 60:99 Enter an integer up to 60. Enter an integer between 0 and 60:60 Using 60 for the window parameter. Dashboard Calendar To Do Notifications Inbox

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions