Skip to content
Laviyx Learn

Try

Mini project

Student Result Management System in Python

A Python program that stores students and their marks in SQLite, calculates totals, percentages and grades, and prints a class report with toppers and pass percentage.

Beginner 1–2 weeks 1 studentUpdated

PythonSQLitesqlite3 moduleCSV

The problem

Teachers often keep marks in spreadsheets and calculate results by hand at the end of every exam. Mistakes in totals and grades are common, and finding the class topper or the students who failed takes time.

This project gives a teacher a small menu-driven program: add students, enter marks for each subject, and get correct results and a class summary instantly. Everything is saved in a database file, so nothing is lost when the program closes.

Features to build

  • Add, edit, search and delete students (roll number, name, class)
  • Enter marks for each subject, with checks that marks are between 0 and the maximum
  • Calculate total, percentage and grade for every student using one grading function
  • Show a student's mark sheet by roll number
  • Class report: topper, class average, pass percentage and the list of students who failed
  • Export the class report to a CSV file that opens in Excel
  • Clear error messages for wrong input instead of crashing

Suggested data model

Two tables are enough:

TableColumns
studentsroll_no (primary key), name, class_name
marksroll_no (foreign key), subject, marks, max_marks

Store marks, not totals or grades. Calculate those when you need them, so they can never disagree with the marks.

Build plan

  1. 1

    Plan the menu and the grading rules

    Write down every menu option and your grade boundaries (for example 90 and above is O, 80 to 89 is A+). Agree on the pass mark per subject.

  2. 2

    Create the database

    Write a setup function that creates both tables with CREATE TABLE IF NOT EXISTS, so the program works on its first run.

  3. 3

    Student functions

    Write add, find, update and delete functions that use parameterised queries (the ? placeholders), never string formatting.

  4. 4

    Marks entry with validation

    Read marks with input(), convert with int(), and catch ValueError. Reject marks below 0 or above the maximum.

  5. 5

    Result calculation

    Write one function that takes a roll number and returns total, percentage, grade and pass or fail. Test it with a few students whose results you calculated by hand.

  6. 6

    Class report and CSV export

    Use SQL with GROUP BY and ORDER BY for averages and the topper, then write the report with the csv module.

  7. 7

    Test and write the README

    Try wrong inputs on purpose, then describe how to run the program, with a screenshot of a mark sheet.

Learn these first

Each part of the project is taught in one of these free lessons.

Make it stand out

  • Import students and marks from a CSV file sent by the class teacher
  • Subject-wise analysis: average and highest mark per subject
  • A simple window interface with Tkinter instead of a text menu
  • Save a PDF mark sheet for each student

Viva and interview questions

Try to answer each one aloud before you open it.

  • Why did you use a database instead of a text file?

    A database lets me search, update and summarise records with SQL instead of reading and rewriting the whole file. It also enforces rules such as a unique roll number with a primary key.

  • Why don't you store the total and grade in the table?

    They can be calculated from the marks. Storing them would duplicate data, and if a mark changed but the total did not, the two would disagree. Calculating them avoids that.

  • What is a parameterised query and why did you use it?

    It sends the values separately from the SQL text, using placeholders like ?. The database treats them as data, never as SQL, which prevents SQL injection and problems with names that contain quotes.

  • What happens if the user types letters when entering marks?

    int() raises a ValueError. I catch it with try and except, show a message, and ask again, so the program does not crash.

  • How would this change for 10,000 students?

    SQLite still handles that size easily. I would add an index on the columns I search most, such as roll_no in the marks table, and page long reports instead of printing everything at once.

What to put in your project report

  1. Abstract: the problem, your solution and the result in one paragraph.
  2. Introduction and problem statement: who has the problem and why it matters.
  3. Requirements: the features (functional) and qualities such as speed and security (non-functional).
  4. Design: architecture diagram, database tables or data flow, and screen layouts.
  5. Implementation: the main modules and the most interesting code, explained.
  6. Testing: the test cases you ran, with inputs, expected and actual results.
  7. Results: screenshots or numbers that show the project working.
  8. Conclusion and future scope: what you achieved and what you would add next.

Your college may give its own format. Follow that first, and use this list to check nothing is missing.

All project ideas →