Python Grading Script

September 2012

Motivation
In my first semester teaching at Washington Adventist University, deployment of the learning management system (Desire2Learn) was not yet automatic for all courses, so an online gradebook would be unavailable unless I specifically requested a course shell in D2L. I had received only the most basic one-day training in D2L, so I opted to start out slowly, maintaining a course shell only for my discrete mathematics class. For the two sections of college algebra and the one section of precalculus, I would have to find other solutions.
Implementation details
  • An Excel spreadsheet synchronized between home and work computers by Dropbox would have served adequately, but I much preferred direct remote access to my home computer via SSH. Since X forwarding would suffer from intolerable lag times, I wanted to keep the grades recorded in flat-text files that I could edit and process in a simple terminal window.
  • Each course would have its own directory for gradebook entries, and each student would have a separate tab-separated file listing all the grades earned to date.
  • The grade file has three fields per line, one for the name of the assignment, one for the assignment type, and the last field for the grade earned on that assignment.
  • A separate file called weights also has three fields per line, controlling how each assignment type should be weighted, and how many such assignments should be counted.
  • The python script takes the file name as its one argument, makes sure the weights file exists, and then computes the course grade. A summary line reports the grades earned in each assignment category, as well as the overall grade in the course.
Transferrable skills learned from this project
  • populating double-indexed arrays from a text file
  • implementing dot product with looping and the range function
  • formatting output for human readability