From CSE330 Wiki
Install Python Tools
sudo yum install python-setuptools
sudo yum install python-devel
- You will write a python script that reads a set of student grades in from a file and does some basic parsing and processing. here is the section of the python tutorial on reading and writing files.
- An example grades file is here. For the sake of simplicity you can assume that the file name is always going to be grades.txt.
- The first line of the file is of the form: NUM_LABS,NUM_EXAMS,LAB_WEIGHT
- All of the other lines in the file are of the form: FIRSTNAME LASTNAME|GRADE|TYPE
- The FIRSTNAME and LASTNAME fields are the student's full name (always only a first and last name), the GRADE is one grade for the student, and the TYPE describes what kind of assignment the grade was for, in this case either a 'lab' or an 'exam'.
- Your script should read in a grades file with the above format and perform the following:
- Compute the final grade for every student, given that there were a total of NUM_LABS labs, NUM_EXAMS exams, and that the labs account for a total of LAB_WEIGHT percent of the grade.
- Compute the final letter grade based on the final numeric grade (A = 90 or above, B = 80 - 90, C = 70 - 80, D = 60 - 70, F = below 60).
- Ignore any blank lines.
- Sort the students by last name, and print out final grades in that sorted order.
- No names should be hard coded into the script (you will run your script on another file with different student names when we grade your assignment).
- Finally, the script should take one optional command line argument, which is a string to match against student names. Only names that match the string in full or in part, should be printed out with their final grades.
- For example, with the argument 'John' grades for both John Smith and John Locke should be printed (if those are the only two Johns in the grades.txt file)