Skip to content
IT Vizag
← Lists, Dicts & Data

▶ Sign up free for the video, slides & prompts

The lesson below is open to all. Enter your email once to unlock every video, slide deck, prompt and code example on this device.

Checking…

Mini project: student marks report

Lesson 9 of 9 · 2 min read

Totals, grades and toppers from a class's marks.

🎬 Video version coming soon — read it now

Let's combine lists, dictionaries, loops and string cleaning into a report a class teacher could really use.

The data

🔒 Code example: sign up free (above) to unlock it.

Each line is a name and three marks, typed carelessly.

Step 1: clean into a list of dictionaries

🔒 Code example: sign up free (above) to unlock it.

[p.strip() for p in ...] is a list comprehension: a short way to build a list. It's the same as a loop with append.

Step 2: totals, averages and grades

🔒 Code example: sign up free (above) to unlock it.

def grade is a function, a named, reusable piece of code. That's the whole of the next course. all(...) is True only if every mark is 35 or more.

Step 3: print the report

🔒 Code example: sign up free (above) to unlock it.

Step 4: class summary

🔒 Code example: sign up free (above) to unlock it.

Challenges

  1. Find the topper in each subject.
  2. Add a fourth subject and make sure nothing else needs to change.
  3. Show students who failed exactly one subject: they can clear it in supplementary exams.
  4. Ask AI for 30 more messy rows and check your code still works.

What you learned in this course

  • Lists, tuples, sets and dictionaries, and when to use each
  • Looping, filtering, sorting and grouping data
  • Lists of dictionaries: the shape of real data
  • Cleaning messy text, and generating safe practice data with AI

Next course: Functions & Clean Code. You'll break programs like this into small reusable pieces, handle errors and debug calmly.

In one line

You turned messy text into a ranked report with grades and a class summary, which is real data work.

Saved on this device. Sign in to keep progress everywhere.

Share with a friend