CS 170 Program 3: Files and Dictionaries

Assignment date: 2 November 2018

Due date: 10 November 2018

This program involves reading and summarizing data from a file.

This program will summarize weather data that is stored in a file. Each line of the input file will contain information about a single day. That information will be in exactly the format given below.

3/29/2013 43 22 0.0
3/30/2013 37 18 0.05
3/31/2013 38 20 0.2
4/1/2013 44 34 0.0
4/2/2013 50 38 0.0
4/3/2013 48 37 0.3
where the first characters encode the date in a month/day/year format, then there are two integers encoding the high temperature and low temperature for the day, then there is a floating point value encoding the inches of precipitation. The exact data above is available online in a file called practice.txt. You should use this data to test your program. A much larger data file will be made available soon.

Your program needs to read this data, store it internally, and report the maximum, minimum and median high and low temperatures for each month and the total rainfall for each month. For example, the report for the above data would look like:

3/2013 Max: 43 Min: 18 Med High: 38 Med Low: 20 Precip: 0.25
4/2013 Max: 50 Min: 34 Med High: 48 Med Low: 37 Precip: 0.3
You don't know how many months worth of data there will be. Your program should produce a line of report for each month/year that appears in the data.

You should break your code up into reasonable functions, use clear variable names (not just x and w and y), document your code clearly using comments and test it to convince yourself that it works properly. When all these tasks are completed, please upload your source code (weather.py) choosing Program 3 as the assignment.