🧮 EXAMINATION RESULT PROCESSING
SYSTEM
Using Python and MySQL Connectivity
Table of Contents
1. Abstract
2. Introduction
3. Objectives
4. System Requirements
5. Database Design
6. Source Code (Python + MySQL Connectivity)
7. Sample Output
8. Conclusion
9. Bibliography
1. Abstract
The Examination Result Processing System is a Python-based
application designed to simplify the task of recording, calculating, and
managing student examination results.By integrating Python and MySQL, this
project provides a simple and reliable way for educational institutions to
automate result processing, including calculating total marks, percentages, and
grades.This system helps reduce manual work, improves accuracy, and ensures
that student results are securely stored and easily accessible. It demonstrates
real-world database connectivity and automation using Python and SQL.
2. Introduction
Every educational institution needs an efficient way to process examination
results. Traditionally, teachers manually calculate totals, percentages, and
grades — a process that is time-consuming and prone to errors.
The Examination Result Processing System automates this process using
Python as the programming interface and MySQL as the backend database.
Key features include:
Adding student exam records
Automatic calculation of total marks, percentage, and grade
Updating and deleting records
Viewing complete result sheets
This project is ideal for learning Python-MySQL integration and serves as a
base for more advanced student information systems.
3. Objectives
To automate the examination result management process.
To use MySQL for secure data storage and retrieval.
To minimize calculation errors by automating total and grade
computation.
To simplify the process of result entry, modification, and reporting.
To demonstrate real-world database programming using Python.
4. System Requirements
Software Requirements
Python 3.x
MySQL Server
MySQL Connector for Python (mysql-connector-python)
Text Editor / IDE (VS Code, PyCharm, IDLE)
Hardware Requirements
Processor: 1 GHz or higher
RAM: Minimum 2 GB
Disk Space: 500 MB
5. Database Design
Database Name: exam_db
Table Name: results
Column Name Data Type Description
roll_no INT (Primary Key) Student Roll Number
name VARCHAR(50) Student Name
marks_sub1 INT Marks in Subject 1
marks_sub2 INT Marks in Subject 2
marks_sub3 INT Marks in Subject 3
total INT Total Marks
percentage FLOAT Percentage
grade VARCHAR(2) Grade (A+, A, B, etc.)
6. Source Code (Python + SQL Connectivity)
import mysql.connector
# Establish MySQL connection
con = mysql.connector.connect(
host="localhost",
user="root",
password="your_password",
database="exam_db"
)
cursor = con.cursor()
# Create table if not exists
cursor.execute("""
CREATE TABLE IF NOT EXISTS results (
roll_no INT PRIMARY KEY,
name VARCHAR(50),
marks_sub1 INT,
marks_sub2 INT,
marks_sub3 INT,
total INT,
percentage FLOAT,
grade VARCHAR(2)
""")
# Function to calculate grade
def calc_grade(percentage):
if percentage >= 90:
return 'A+'
elif percentage >= 80:
return 'A'
elif percentage >= 70:
return 'B'
elif percentage >= 60:
return 'C'
elif percentage >= 50:
return 'D'
else:
return 'F'
# Add new student record
def add_result():
roll = int(input("Enter Roll Number: "))
name = input("Enter Student Name: ")
sub1 = int(input("Enter Marks in Subject 1: "))
sub2 = int(input("Enter Marks in Subject 2: "))
sub3 = int(input("Enter Marks in Subject 3: "))
total = sub1 + sub2 + sub3
percentage = total / 3
grade = calc_grade(percentage)
query = "INSERT INTO results VALUES (%s,%s,%s,%s,%s,%s,%s,%s)"
data = (roll, name, sub1, sub2, sub3, total, percentage, grade)
cursor.execute(query, data)
con.commit()
print("✅ Result Added Successfully!")
# View all results
def view_results():
cursor.execute("SELECT * FROM results")
data = cursor.fetchall()
print("\nRoll | Name | Sub1 | Sub2 | Sub3 | Total | % | Grade")
print("-"*70)
for row in data:
print(row)
# Search student result
def search_result():
roll = int(input("Enter Roll Number to Search: "))
cursor.execute("SELECT * FROM results WHERE roll_no=%s", (roll,))
data = cursor.fetchone()
if data:
print("Roll | Name | Sub1 | Sub2 | Sub3 | Total | % | Grade")
print(data)
else:
print("❌ No Record Found!")
# Update marks
def update_result():
roll = int(input("Enter Roll Number to Update: "))
sub1 = int(input("Enter New Marks in Subject 1: "))
sub2 = int(input("Enter New Marks in Subject 2: "))
sub3 = int(input("Enter New Marks in Subject 3: "))
total = sub1 + sub2 + sub3
percentage = total / 3
grade = calc_grade(percentage)
cursor.execute("""
UPDATE results
SET marks_sub1=%s, marks_sub2=%s, marks_sub3=%s, total=%s,
percentage=%s, grade=%s
WHERE roll_no=%s
""", (sub1, sub2, sub3, total, percentage, grade, roll))
con.commit()
print("✅ Result Updated Successfully!")
# Delete record
def delete_result():
roll = int(input("Enter Roll Number to Delete: "))
cursor.execute("DELETE FROM results WHERE roll_no=%s", (roll,))
con.commit()
print(" Record Deleted Successfully!")
# Main menu
while True:
print("\n===== EXAMINATION RESULT PROCESSING SYSTEM
=====")
print("1. Add Student Result")
print("2. View All Results")
print("3. Search Student Result")
print("4. Update Result")
print("5. Delete Result")
print("6. Exit")
choice = input("Enter your choice (1-6): ")
if choice == '1':
add_result()
elif choice == '2':
view_results()
elif choice == '3':
search_result()
elif choice == '4':
update_result()
elif choice == '5':
delete_result()
elif choice == '6':
print("Exiting... Goodbye!")
break
else:
print("Invalid Choice! Try Again.")
7. Sample Output
===== EXAMINATION RESULT PROCESSING SYSTEM =====
1. Add Student Result
2. View All Results
3. Search Student Result
4. Update Result
5. Delete Result
6. Exit
Enter your choice (1-6): 1
Enter Roll Number: 101
Enter Student Name: Rohan
Enter Marks in Subject 1: 85
Enter Marks in Subject 2: 90
Enter Marks in Subject 3: 80
Enter your choice (1-6): 2
Roll | Name | Sub1 | Sub2 | Sub3 | Total | % | Grade
-------------------------------------------------------------
(101, 'Rohan', 85, 90, 80, 255, 85.0, 'A')
Enter your choice (1-6): 4
Enter Roll Number to Update: 101
Enter New Marks in Subject 1: 90
Enter New Marks in Subject 2: 95
Enter New Marks in Subject 3: 89
Enter your choice (1-6): 2
(101, 'Rohan', 90, 95, 89, 274, 91.33, 'A+')
8. Conclusion
The Examination Result Processing System automates the process of
managing and generating student results.
It stores student marks securely in a MySQL database, calculates totals,
percentages, and grades automatically, and allows easy updating or deletion of
records.
This system:
Simplifies result processing
Reduces calculation errors
Demonstrates Python-MySQL database integration
Future enhancements may include:
Graphical user interface using Tkinter or PyQt
PDF result sheet generation
Role-based login (Admin/Teacher)
Multi-subject or semester result management
Overall, this project showcases how Python and SQL can work together to
create practical, real-world educational management systems.
9. Bibliography
1. Python Documentation – https://docs.python.org/3/
2. MySQL Documentation – https://dev.mysql.com/doc/
3. GeeksforGeeks – Python MySQL Connectivity Tutorials
4. W3Schools – https://www.w3schools.com/python/
5. TutorialsPoint – Python Database Programming Guide