Skip to content
ProjectsDigital & Software Systems

A grade-handling program in Python

Loads, validates, computes and plots a class's assignment grades

Image needed

/images/grade-program-python/hero.webp

Two matplotlib plots side by side: a scatter chart titled Assignment Grade distribution showing each student's grades across three assignments with a red mean line, and a bell-curve chart titled Final grades norm

hero.webp
Two of the program's three views: the assignment scatter and the final-grade normal distribution.
Context
Introduction to Programming and Data Processing, DTU
Year
2023
Role
Sole author
Team size
1
Tools
Python · NumPy · Matplotlib · File I/O · State machine · Data validation
Contribution
Sole author, wrote the whole program

A menu-driven program that reads a file of student IDs, names and assignment grades, computes each final grade by dropping the lowest assignment and rounding the mean onto the Danish 7-step scale, checks the file for errors, and plots the result three ways.

What it does

The program runs as a small state machine with five options, and the useful part of it is the one that is least interesting to look at, in that the error check goes through the loaded file for duplicate student IDs, grades that do not exist on the 7-step scale, missing IDs and missing grades, and reports the line each problem is on. Here the test file was written with a broken row in it deliberately, since a validator that has only ever been shown clean data has not really been tested.

The part I would keep

Final grades are computed by dropping each student's lowest assignment, averaging what is left and rounding onto the nearest allowed grade by absolute distance, with a -3 anywhere overriding the average, and the whole thing runs on a deep copy so that the loaded data survives being processed. Furthermore the plotting covers three views, being a bar chart of the grade distribution, a normal distribution of the final grades, and a scatter of every individual assignment grade with the mean drawn through it.

What I would do differently

This was written in May 2023 for the introductory programming course, before I used any AI tooling, and it reads like it in places, since the grade counting is seven manual counters where a dictionary would do, and I left a comment in the file at the time saying exactly that. It is important to note that the normal distribution curve divides by the mean where it should divide by the standard deviation, which I did not catch then and would catch now.