Question: this is a sample Program has to be in python Three lists have been created and initialized. Use these lists to compute the average temperature
this is a sample
Program has to be in python Three lists have been created and initialized. Use these lists to compute the average temperature for each month. Print both to the screen and the output file, a list with the month name followed by the average temperature for that month. Ignore invalid data (temperatures of -99) #import os import tkinter as tk from tkinter.filedialog import . input file fn_in-askopenfilename titlen'select input file. filetypes (..TXT ..txt")) {_in - open(fn_in, *** + output file En out -asksaveasfilename title="Select output filetypes (*.TXT **.txt")) f_out - open(fn_out, "w"> temp_sum stores 12 temperature suns. temp_suntoj stores the sum of all the temperatures in January, temp_sum[1] stores the sum of all the temperatures in Pebruary, etc. temp_count stores 12 temperature counts. temp.count [0] stores how many temperatures were recorded in January, temp_sum1 stores how many temperatures were recorded in February, etc. month_name[month_number - 1) is the name of the month designated by nonth number temp_sum - 10.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 temp_count - 10,0,0,0,0,0,0,0,0,0,0,0) month name - ('Jan', 'Feb", "Mar', 'Apr May Jun', 'Jul, Aug'. 'Sep Oct Nov', 'Dee) line_list - f_in.readlines for line in line list: s-line.split() month, tenpints[0]), float(-11) print(month, temp) _out.write(str(month) + '\+ str{tenp) . _in.close() f_out.close() Three lists have been created and initialized. Use these lists to compute the average temperature for each month. Print both to the screen and the output file, a list with the month name followed by the average temperature for that month
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
