Programming assignment 2

At this point we have covered the basic python collections (lists and dicts) and simple file parsing. Reading a file and storing the contents in memory in reasonable data structures is a crucial part of most scripts. This exercise is not biological, but it should help you think about what is the most reasonable way to store the data. There are many right answers - I'm not looking for one specific solution.

Write a program that calculates mean grades.

Your program should read in a tab-separated file with grades for students like this grades.txt .

The program should take a command like argument which indicates what mean you want. The argument can specify either the row or column for which you would like to see the mean. This could be an graded component of the course (for example 'Exam1' or 'Exam2' if you want to see the average grade for all students) or a student ID (if you want to see that student's average).

- '\t' is a string representing a tab. Just like '\n' is the representation of a newline.
- Student names may not be unique
- Assume that the ID column will be unique
- Some students have do not have grades for both exams. Skip these students in the calculation of the mean.

The best way to write such a program is to write the code for parsing the data into python data structures (lists or dicts). Next process the command line argument that tells you what the mean the user would like to see, and then calculate that quantity.

In other words, don't write a separate parser for the input file depending on whether or not you want a row or column mean. Writing separate parsers might result in a slightly faster programmer, but it is a lot more work to maintain separate parsers.