Skip to content

mitraboga/GradebookGenerator

Repository files navigation

πŸ“š Gradebook Generator - CS50P Final Project ✏️

CS50P Final Project β€” Multi-Year Grade Tracking + CSV Export + Average Visualization

Python PrettyTable CSV Export Matplotlib Pytest


Gradebook Generator Preview (GIF)


πŸ“ƒ Description

For my final project in CS50P, I have chosen to create a Gradebook Generator. This project embodies the essence of what I believe to be an invaluable tool for students who wish to easily visualize their grades and track their academic progress over time. The Gradebook Generator provides a highly efficient and user-friendly solution for creating and maintaining a spreadsheet that keeps tabs on one's grades throughout high school or university.

The core functionality of my program is designed with simplicity and accessibility in mind. The user interface walks students through a series of prompts, guiding them to input their academic data as requested by the program. This design ensures that even users with minimal technical knowledge can navigate and use the Gradebook Generator with ease.

Once the user has inputted their data, my program leverages the power of the 'prettytable' functionality to generate a visually appealing and organized Gradebook. This Gradebook not only displays the students' grades for each course but also calculates their average grades per semester and per year. This feature allows students to get a comprehensive overview of their academic performance at a glance, making it easier for them to identify areas where they excel and areas where they might need improvement.

In addition to generating a visual Gradebook, my program also creates a CSV (comma-separated values) file named 'gradebook.csv'. This file can be easily downloaded and imported into popular spreadsheet applications such as Microsoft Excel or Google Sheets. The CSV file format ensures compatibility across different platforms, allowing users to further manipulate and analyze their data if they wish. By providing this feature, my program extends its utility beyond just grade visualization, offering users the flexibility to create a comprehensive and customizable academic record.

Furthermore, the Gradebook Generator includes a feature that generates a bar graph saved as 'avg_comparison.png' using the matplotlib library. This graph provides a visual comparison of the user's academic performance over the years. By presenting the data in a graphical format, students can more easily discern trends in their academic performance, such as improvements or declines in their grades over time. This visual representation adds an extra layer of insight, helping students to better understand their academic journey.

The experience is designed to be student-friendly:

  • The program guides you with clear prompts.
  • It validates input (so wrong types don’t crash the program).
  • It outputs results in clean PrettyTable format.
  • It exports a structured CSV that can be opened in Excel / Google Sheets.
  • It generates a visual comparison chart saved as avg_comparison.png.

βš™οΈ What the Program Does

1) Interactive Grade Entry (Years β†’ Semesters β†’ Courses)

You enter:

  • School Year (example: 2023-2024)
  • Any number of Semesters for that year
  • Any number of Courses per semester

For each course you input:

  • Number of Assignments / Quizzes / Tests / Exams
  • Weightage (%) for each category
  • The individual grades for each item (supports decimals)

You can type exit at multiple steps to quit cleanly.


2) Clean Console Output via PrettyTable

For every semester, the program prints a PrettyTable showing:

  • Course name
  • Final weighted grade (formatted to 2 decimals)

This makes results readable instantly without needing Excel first.

PrettyTable Output β€” Part 1

PrettyTable Output - Part 1

PrettyTable Output β€” Part 2

PrettyTable Output - Part 2

PrettyTable Output β€” Part 3

PrettyTable Output - Part 3


3) Automatic Averages (Semester β†’ Year β†’ Overall)

The generator calculates:

  • βœ… Average per semester
  • βœ… Average per year
  • βœ… Overall average across all years

This turns raw entries into a real β€œacademic performance tracker” that helps students spot trends early.


4) CSV Export: gradebook.csv

After the run completes, the program exports a full spreadsheet file named:

  • gradebook.csv

This CSV includes:

  • Year
  • Semester
  • Course breakdown
  • Assessment counts
  • Weightings
  • Final grade per course
  • Semester averages
  • Year averages
  • Overall average across all years

You can open this directly in:

  • Microsoft Excel
  • Google Sheets

CSV Output Preview in Google Sheets


5) Data Visualization: avg_comparison.png

The program also generates and saves a chart:

  • avg_comparison.png

This graph helps students quickly see how they’re doing over time β€” not just as numbers, but as a visual trajectory of performance (upward, flat, or declining).

Average Comparison Chart


πŸ‘½ Uniqueness

What makes this project different isn’t just β€œit calculates grades”.

It’s that it’s built like a real student tool:

  • Input validation so mistakes don’t break the run
  • Multi-year structure (not just one course / one semester)
  • PrettyTable output that feels like a polished CLI app
  • CSV export that becomes your long-term academic archive
  • Matplotlib visualization for fast performance comparison
  • Unit tests to prove core logic works

Workflow:

User input β†’ clean CLI tables β†’ averages β†’ CSV export β†’ graph saved


πŸ§ͺ Testing (pytest)

This project includes automated unit tests using pytest.

The tests validate:

  • get_integer_input() handling valid integer input
  • get_float_input() handling exit
  • calculate_grade() correctness for weighted averages

It uses unittest.mock.patch to simulate user input without manual typing.

Run tests

pytest -q

Pytest Unit Tests - 3 Passed


πŸ“ Repo Structure

.
β”œβ”€β”€ project.py
β”œβ”€β”€ test_project.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ gradebook.csv                    # generated after running project.py
β”œβ”€β”€ avg_comparison.png               # generated after running project.py
β”œβ”€β”€ gradebook.csv.png                # screenshot (proof)
β”œβ”€β”€ Terminal Gradebook 1.png         # screenshot (proof)
β”œβ”€β”€ Terminal Gradebook 2.png         # screenshot (proof)
β”œβ”€β”€ Terminal Gradebook 3.png         # screenshot (proof)
└── Gradebook_Generator_Preview.gif  # you will add this

πŸ› οΈ Setup

1) Create a virtual environment (recommended)

Windows:

python -m venv .venv
.venv\Scripts\activate

macOS/Linux:

python -m venv .venv
source .venv/bin/activate

2) Install dependencies

pip install -r requirements.txt

▢️ Run the Program

python project.py

Outputs created after running:

  • gradebook.csv
  • avg_comparison.png

πŸ“Œ Importing CSV into Google Sheets / Excel

Google Sheets

  1. Open Google Sheets
  2. File β†’ Import
  3. Upload gradebook.csv
  4. Choose β€œReplace spreadsheet” or β€œInsert new sheet”
  5. Done

Excel

  1. Open Excel
  2. File β†’ Open
  3. Select gradebook.csv
  4. Done

βœ’οΈ Summary

Gradebook Generator is a complete CS50P final project that helps students:

  • enter grades cleanly (with validation),
  • calculate weighted results,
  • compute averages across semesters + years,
  • export everything into a spreadsheet,
  • and visualize progress with a performance graph.

It’s a real-world grade tracking workflow built in Python β€” not just a calculator.


πŸ‘€ Author

Mitra Boga

About

Final Project for Harvard's CS50P. Created a Gradebook Generator that neatly and efficiently creates a Spreadsheet for Students to Organize and Analyze their Academic Progress

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages