Course outline · 0% complete

0/32 lessons0%

Course overview →

Project: Gradebook

lesson 10-3 · ~13 min · 32/32

The report

A gradebook maps each student to a list of scores, a dict of lists, the first time you have nested two containers:

students = {
    "Ada": [90, 95, 88],
    "Grace": [72, 85, 80],
    "Alan": [60, 75, 70],
}

The program prints one line per student with their average and letter grade, reusing average() and letter() exactly as you wrote them in lesson 8-3. That is decomposition paying off: the hard thinking is already done and named.

Code exercise · python

Run the per-student report. The items() loop hands you each name and score list in turn.

Quiz

In `for name, scores in students.items():`, what is `scores` on the first pass?

Code exercise · python

Your turn, the finale. Below the given setup, compute and print two summary lines: `class average: 79.4` (average of ALL nine scores, use a nested loop: for each score list, for each score) and `top student: Ada` (the student with the highest average, a find-the-max scan).

Where you stand

Count what these three projects used: input and conversion (unit 3), elif chains and truthiness (unit 4), while/break and the four loop patterns (unit 5), lists (unit 6), dicts, tuples, and sets (unit 7), functions and decomposition (unit 8), and the counting and find-the-max idioms throughout. That is the working core of Python.

From here, good next steps on the platform: keep the patterns sharp on the DSA problems (start with the easy array and string ones, they are these loop patterns in disguise), and when a program crashes, read the traceback bottom-up like you practiced in lesson 9-1 before touching the code.

Problem

A fourth student joins: `"Linus": [88, 92]`. Using the letter bands from this lesson (90+ A, 80+ B, 70+ C, else F), what letter grade does the gradebook print for Linus?