Python for Beginners · Course lab · about 120 minutes · 7 tasks · marked out of 100, pass at 60

Build the result system for a real academy

The situation

Sir Imran runs a computer academy in Sialkot with forty students in two batches. Marks, attendance and fee status live in a notebook, and every month he spends an evening working out by hand who passed, who earns a certificate (marks of 50 or more AND attendance of 75% or more AND fee paid), and what the class average was.

He wants a program that does all of it from a list he can edit himself — and that he can change when the rules change, without asking anybody.

What you'll be able to show

  • Hold real records in a list of dictionaries and loop over them
  • Put every rule in one function, so a rule change is a one-line edit
  • Read an error message and fix the line it names
  • Show a working program to somebody else and explain each part

What you need

  • Any free online Python editor — nothing to install (the one linked in your BvLogic dashboard is fine)
  • The code from lessons 5, 6 and 8
  • A notes file for your test cases and the errors you meet

Tasks

  1. 1Build the data
    Create a list called students holding twelve dictionaries, each with name, city, marks, attendance and fee_paid (True or False). Make three of them deliberately awkward: one with attendance below 75 but marks above 50, one with marks below 50, and one with fee_paid set to False.
    A correct result: print(len(students)) shows 12, and you can point at the three awkward records by name.
  2. 2Write grade(marks)
    A function that returns "A" for 80 and above, "B" for 65 and above, "Pass" for 50 and above, and "Fail" otherwise. Call it four times: 85, 65, 50, 49.
    A correct result: The four calls print A, B, Pass, Fail — in that order, with 50 and 49 on opposite sides of the line.
  3. 3Write gets_certificate(student)
    A function that takes one student dictionary and returns True only when marks are 50 or more, attendance is 75 or more, and fee_paid is True. The rule lives here and nowhere else.
    A correct result: Your three awkward students return False; an ordinary passing student returns True.
  4. 4The monthly report
    Loop over students and print one line each in the shape: Name (City): marks — grade — certificate or no certificate. Use your two functions; do not repeat their rules inside the loop.
    A correct result: Twelve lines, and the three exceptions are readable at a glance without scrolling back to the data.
  5. 5The numbers Sir Imran asks for
    After the loop, print the class average to one decimal place, how many students earned a certificate, and the top scorer's name from a function highest(students) that returns the name.
    A correct result: Three lines. Change one student's marks and run again: the average and possibly the top scorer change, and nothing else breaks.
  6. 6The rule change
    The academy lowers the attendance requirement from 75 to 70. Make the change by editing exactly one line, run the report again, and write down which line you edited and what changed in the output.
    A correct result: One edited line. If you had to change more than one, the rule was copied somewhere it should not have been — fix that first.
  7. 7Break it on purpose
    Remove a colon from an if line, run, read the error and fix it. Then remove one quotation mark, run, read the error and fix it. Copy both error messages into your notes with the line number each one named.
    A correct result: Two error messages in your notes, each naming a line, each fixed in under a minute.

What to hand in

Your .py file (or a share link from the online editor), the printed report pasted in, and five sentences: what grade() does, what gets_certificate() does, what highest() does, which single line you changed in task 6, and which of the two errors was harder to read.

How it is marked

CriterionPoints
Data built correctly, with the three awkward records present and named 15
grade() and gets_certificate() are correct and each rule lives in exactly one place 30
Report loop prints one clear line per student using the functions 20
Average, certificate count and top scorer are correct 20
The rule change was one line, and the five sentences are clear 15
Total · pass at 60 100

Hand in your lab

Create a free BvLogic ID to hand in your lab, get it marked, and have it on your certificate.

Create your BvLogic ID

Already have one? Sign in and this course will be added to it.