Skip to Content
Nextra 4.0 is released 🎉
ReferenceProject GuidesProject 2: Grade TrackerVersion 2: Grade Tracker by Subject

Project 2 (v2): Grade Tracker — By Subject

This is a continuation of the Grade Tracker. Instead of one big list of grades, you’ll organize grades by subject. Each subject is stored as a list that starts with the subject name, followed by its grades — like ["Math", 85, 92, 78]. Your full data is a list of those inner lists.

You’ll use the same topics (lists, loops, conditionals, file I/O) but with a 2D structure, so you get practice with nested loops and indexing.

Keep your original Grade Tracker code in a separate file. This is a new project — work on it after you finish each day’s steps for the original Grade Tracker.

Your data will look like this: [["Math", 85, 92, 78], ["Science", 88, 91], ["English", 76, 82, 90]]. Index 0 of each inner list is the subject name. The rest are that subject’s grades.


Phase 1 (Day 1): Lists and Loops

What you’ll learn

How to create a list of lists and loop through both the outer list and each inner list to display and calculate grades.

Tasks

Topics covered: Lists, Loops

End of Day 1: Your program prints each subject’s grades, total, and average. Good start!

Challenge (optional)

Try adding a new subject using input() — ask for the subject name, then ask for a few grades. Append the new inner list to your outer list and print the updated data.


Phase 2 (Day 2): Conditionals

What you’ll learn

How to use if / elif / else to make decisions based on each subject’s grades — like flagging subjects that need work.

Tasks

Topics covered: If statements, Comparison operators, Loops

End of Day 2: Your program now shows the highest grade, lowest grade, average, and a status message for each subject.


Phase 3 (Day 3): File I/O

What you’ll learn

How to save your grade data to a file and load it back, so the data sticks around between runs.

Before you start

Pick a simple file format. One good option: one line per subject, values separated by commas — like Math,85,92,78. Create an empty file called grades.txt in the same folder as your program before you run it.

Tasks

Topics covered: Handling files, Lists, Loops

End of Day 3: Your Grade Tracker by Subject is complete — it loads, analyzes, and saves data across runs.


Summary

DayFocusWhat you build
1Lists + LoopsA list of lists with each subject’s grades; display totals and averages
2ConditionalsHighest, lowest, and a status message per subject
3File I/OSave and load your data so it persists between runs

You’re using the same core topics as the original Grade Tracker — lists, loops, conditionals, file I/O — but now with a 2D structure. Nested loops take a bit of practice, and you’ll get the hang of it.

Last updated on