Program 3: Weather Library
Logistics
- Due Date: Friday, March 1st no later than 11:59 p.m.
- Partner Information: You may complete this assignment
individually or with exactly one partner. If you work with a partner,
you must both be enrolled in the same lab section or you
will both lose 10 points.
- Submission Instructions (working alone): Upload your solution, entitled
YourFirstName-YourLastName-Program3.py to the BrightSpace
Program 3 Dropbox.
- Submission Instructions (working with one lab mate): Upload your solution,
entitled YourFirstName-YourLastName-PartnerFirstName-PartnerLastName-Program3.py
to the BrightSpace Program 3 Dropbox. Note: If you work with a partner,
only one person needs to submit a solution. If you both submit a solution,
the submission that will be graded is the one from the partner whose
last name comes alphabetically first.
- Deadline Reminder:
Once the submission deadline passes, BrightSpace will no
longer accept your Python submission and you will no longer
be able to earn credit. Thus, if you are not able to fully complete
the assignment, submit whatever you have before the deadline so that
partial credit can be earned.
Learning Outcomes
- To solve this problem, you need to understand the following
Python concept: files.
Background Information
- The input file for this assignment, weather.csv,
is described on this
page.
Assignment
- Using weather.py (renamed according to the
instructions above) as a starting point,
supply the missing functions such that interaction with a user could
produce this sample transcript.
- The function coldest_temperature should find the
Minimum temperature recorded in the file. It should
print this temperature, the location where it was recorded and
the date when it was recorded. Match the output format that appears
in the sample transcript exactly. Note: If the minimal temperature
reading occurs more than once, print out the information associated with
its first occurrence.
- The function average_temperature is passed a Location
(e.g. Miles City, MT) that the user supplies.
The function prints the number of Average temperatures
recorded for this location, as well as the average of these temperatures.
Match the output format in the sample transcript.
You may assume that the user enters the location in a valid
format (e.g. city name, comma, space, state).
- The function all_stations_by_state is passed the State
(e.g. Montana) that receives reporting data from stations.
The function finds and prints in alphabetical order the reporting
stations that send their data to this state.
Match the output format in the sample transcript.
- Study the Weather CSV Library and develop a function of your own
that corresponds to menu option 4. The function should be interesting,
non-trivial and not a simple variation of one of the other functions.
Modify the menu and main functions as appropriate.
Grading - 100 points
- Function coldest_temperature: 20 points
- 5 points. The coldest temperature reading is identified correctly.
(All or nothing.)
- 5 points. The location of the coldest temperature reading
is identified correctly. If the coldest temperature occurs at more
than one location, the first location in the file should be reported.
(All or nothing.)
- 5 points. The date of the coldest temperature reading is identified
correctly. (All or nothing.)
- 5 points. The three lines of output match the format of the output
transcript exactly. (All or nothing.)
- Function average_temperature: 20 points
- 5 points. The number of readings is calculated correctly when the
location appears in the file, regardless of the case of the input.
(All of nothing.)
- 5 points. The average temperature is calculated correctly when the
location appears in the file, regardless of the case of the input.
(All or nothing.)
- 5 points. The two lines of output match the format of the output
transcript exactly when the location appears in the file.
(All or nothing.)
- 5 points. The two lines of output match the format of the output
transcript exactly when the location does NOT appears in the file.
(All or nothing.)
- Function all_stations_by_state: 25 points
- 10 points. The recording stations are identified correctly.
(All or nothing.)
- 5 points. The recording stations are printed in alphabetical order.
(All or nothing.)
- 5 points. The output matches the format of the output transcript
exactly when the state appears in the file. (All or nothing.)
- 5 points. The output matches the format of the output transcript
exactly when the state does NOT appears in the file. (All or nothing.)
- Your function: 20 points
- 5 points. The function is non-trivial. (All or nothing.)
- 5 points. The function is not a simple variation of one of the
other three functions. (All or nothing).
- 10 points. The function works correctly. (All or nothing.)
- Style and Quality: 15 points
- The Python solution is of high quality, properly commented,
easy to understand and does not contain unnecessary code.
(3 points for each type of improvement up to 15 points.)