Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import tkinter as tk from tkinter.filedialog import * fn_in = askopenfilename(title = Select input file, filetypes = [(.TXT, .txt)]) f_in = open(fn_in, r) fn_out =

import tkinter as tk from tkinter.filedialog import *

fn_in = askopenfilename(title = "Select input file", filetypes = [(".TXT", ".txt")]) f_in = open(fn_in, "r")

fn_out = asksaveasfilename(title="Select output file", filetypes=[("*.TXT", "*.txt")]) f_out = open(fn_out, "w")

d = dict() tem_p = dict() line_list = f_in.readlines()

for line in line_list: s = line.split() month, temp = int (s[0]), float(s[-1]) print(str(month)+ '\t' + str( temp)+ ' ') tem_p[month] = temp + tem_p.get(month,0) f_out.write(str(month) + '\t' + str(temp) + ' ') tem_p[month] = tem_p.get(month,0) + temp d[month] = d.get(month,0) + 1

f_in.close() f_out.close()

for x,y in d.items(): total_sum = tem_p[x] count_days = d[x] if total_sum == -99: continue else: print(total_sum/count_days)

-----------------

This is my code. I want to add a print statement that prints months name Jan-Dec.

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

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions

Question

Choose natural conversational words

Answered: 1 week ago

Question

Explain exothermic and endothermic reactions with examples

Answered: 1 week ago