ANAND NIKETAN SUGHAD
PROJECT REPORT
COMPUTER SCIENCE (083)
STUDENT MANAGEMENT SYSTEM
SUBMITTED BY
NAME : SONALI PATEL ROLL NO.
1|Page
TABLE OF CONTENTS
Certificate
Acknowledgement
Preface of Project
Project Description
Hardware & Software Specifications
Python Modules Used
Database Design
Project Code
Sample Outputs
Scope of the Project
Bibliography
2|Page
PREFACE OF PROJECT
I have chosen this Project titled "Student Management System"
along with my Project partner Mahek Tahilani. The project will
help to build a robust computerized system for maintaining
student records in a school. The project is designed to make the
task of keeping records of the several students easier and help you
to prepare result sheet of students. The project is based on
database connectivity of MySQL and Python.
I was inclined towards this topic as In the ever-evolving
landscape of education, the efficient management of student data
is pivotal to the success of academic institutions. This project, the
Student Management System (SMS), is a thoughtful response to
the evolving needs of educational administration in the digital
age. Recognizing the challenges faced by institutions in handling
diverse aspects of student information, from enrollment to
performance tracking, this project seeks to introduce a
comprehensive solution. Developed with the objective of
enhancing administrative efficiency and promoting data accuracy,
the SMS endeavors to be a reliable tool for educators and
administrators alike. By embracing modern technologies,
particularly focusing on the versatility and capabilities of Python,
this system aspires to redefine the way student information is
handled, offering a centralized, automated, and user-friendly
3|Page
approach. This preface serves as an introduction to the project's
aspirations, acknowledging the significance of technology in the
realm of education and emphasizing the transformative potential
of the Student Management System. As we embark on this
technological journey, the ultimate goal is to contribute to an
educational ecosystem where administrative processes are
streamlined, and educators can focus more on what truly matters
– nurturing the academic growth of the students.
4|Page
PROJECT DESCRIPTION
The Project uses Python as a programming language and MySQL
as the Backend tool. The Project has two main modules:
1. User Management
This module allows you to create or delete user records. The module
has a menu-driven interface to login into the Student Management
module with the appropriate username and password.
2. Student Management
This module has a user-friendly interface to maintain student
records. It helps in adding new student records as and when
required and also getting in details of the students like student
registration no, name, class, address, marks in three subjects and
displaying the result summary sheet containing percentage
obtained by students.
It also helps in modifying incorrect data, updating student data, the
addition of new students’ data, or the deletion of an existing
student’s data whenever there is a need.
It also helps in displaying a particular student’s details by
searching all the student records that are present in the database.
It also helps in deleting a student record from the database based
on registration no.
5|Page
It has a sub-module to display all student records in sorted order
either by Class, Name, or Percent.
It has a sub-module to display the details of the topper student.
It has a sub-module to display the column chart depicting marks in
physics, chemistry, and mathematics for students of each class.
6|Page
HARDWARE & SOFTWARE
SPECIFICATIONS
HARDWARE SPECIFICATIONS:-
Processor : Intel Core I3 and above
Hard Disk : 500 GB
Ram : 8 GB
SOFTWARE SPECIFICATIONS:-
Operating System : Windows 11
Platform : Python IDLE 3.7
Database : MySQL
Languages : Python
Note: For Python-MySQL connectivity, following data have been used:-
Host- localhost, user- root, password- root, database- school
7|Page
PYTHON MODULES USED
1. mysql.connector – for connecting mysql databases from
within python
2. sys – for access to the variables and functions that interact
strongly with the interpreter.
3. pandas – for data manipulation and analysis that provides
high- performance, easy to use data structures,and data
analysis tools.
4. numpy– for numerical computing that facilitates the
manipulation of large.
5. tabulate– for creating nicely formatted tables
8|Page
SOURCE CODE (PYTHON)
import sys
import mysql.connector
import pandas as pdf
import numpy as np
from tabulate import tabulate
def usermenu():
while True:
print("\t\t--------------------------")
print("\t\t1. Add New User")
print("\t\t2. Delete User")
print("\t\t3. Login to MainMenu")
print("\t\t4. Exit")
print("\t\t--------------------------")
10 | P a g e
choice=eval(input("Enter your
choice:"))
if choice==1:
adduser()
elif choice==2:
deleteuser()
elif choice==3:
login()
else:
sys.exit()
def adduser():
try:
print("-----Enter New User
Details-------")
user=input("Enter Username:")
pwd=input("Input Password:")
11 | P a g e
if mydb.is_connected():
mycursor=mydb.cursor()
sql="Insert into Users
values('"+user+"','"+pwd+"')"
mycursor.execute(sql)
mydb.commit()
print("New User Registered
Successfully")
else:
print("User Registration
Unsuccessful")
except Exception as e:
print("Error",e)
def deleteuser():
try:
user=input("Enter Username to
delete:")
12 | P a g e
if mydb.is_connected():
mycursor=mydb.cursor()
sql="Delete From Users where
user='"+user+"'"
mycursor.execute(sql)
mydb.commit()
if (mycursor.rowcount!=0):
print("User record deleted
successfully")
else:
print("User record does not
exists!!!")
except Exception as e:
print("Error",e)
def login():
try:
13 | P a g e
mydb=mysql.connector.connect(host="localh
ost",user="root",password="root",database=
'school')
user=input("Enter Username:")
pwd=input("Input Password:")
if mydb.is_connected():
mycursor=mydb.cursor()
sql="Select * from users where
user='"+user+"'"
mycursor.execute(sql)
myrecord=mycursor.fetchone()
if mycursor.rowcount==1:
if myrecord[1]==pwd:
print("User: "+user+ ", Login
Successfull")
mainmenu(user)
else:
14 | P a g e
print("Invalid password")
elif mycursor.rowcount==-1:
print("Invalid username")
except Exception as e:
print("Error",e)
def mainmenu(user):
while True:
print("\t\t-----MAIN MENU------User:
"+user)
print("\t\t-------------------------------")
print("\t\t1. Add Student Detail")
print("\t\t2. Update Student Detail")
print("\t\t3. Search Student Detail")
print("\t\t4. Delete Student Detail")
print("\t\t5. Show All Result")
print("\t\t6. Show All Student Details")
15 | P a g e
print("\t\t7. Show Summary in Order")
print("\t\t8. Display topper details")
print("\t\t9. Log Out")
print("\t\t0. Exit")
print("\t\t-------------------------------")
choice=eval(input("Enter your
choice:"))
if choice==1:
addstudent()
elif choice==2:
updatestudent()
elif choice==3:
searchmenu()
elif choice==4:
deletestudent()
elif choice==5:
showallresult()
16 | P a g e
elif choice==6:
showall()
elif choice==7:
showorderwise()
elif choice==8:
showtopper()
elif choice==9:
break
elif choice==0:
sys.exit()
def addstudent():
try:
regno=initregno()
print(regno)
print("-----Input New Student
Details-----")
17 | P a g e
name=input("Enter student name: ")
cls=int(input("Enter standard/class:"))
gender=input("Enter gender
(male/female):")
address=input("Enter address:")
contact=input("Enter contact no.: ")
dob=input("Enter date of birth(yyyy-
mm-dd): ")
pm=int(input("Enter physics marks: "))
cm=int(input("Enter chemistry marks:
"))
mm=int(input("Enter maths marks: "))
if mydb.is_connected():
mycursor=mydb.cursor()
sql="Insert into Students
values("+str(regno)+",'"+name+"',"+str(cls)
+",'"+gender+"','"+address+"','"+contact+"',
'"+dob+"',"+str(pm)+","+str(cm)
+","+str(mm)+")"
18 | P a g e
mycursor.execute(sql)
mydb.commit()
print("New Student Record Added
Successfully")
else:
print("New Student Record Insertion
Unsuccessful")
except Exception as e:
print("Error",e)
def initregno():
try:
if mydb.is_connected():
mycursor=mydb.cursor()
sql="Select max(regno) from
students"
mycursor.execute(sql)
myrecord=mycursor.fetchone()
19 | P a g e
if myrecord==(None,):
regno=1
else:
regno=int(myrecord[0])+1
return regno
except Exception as e:
print("Error",e)
def updatestudent():
try:
regno=int(input("Enter Student
Registration No:"))
while True:
print("\t\
t----------------------------------")
print("\t\t1. To update name")
print("\t\t2. To update class")
20 | P a g e
print("\t\t3. To update gender")
print("\t\t4. To update address")
print("\t\t5. To update contact
no.")
print("\t\t6. To update dob")
print("\t\t7. To update physics
marks")
print("\t\t8. To update chemistry
marks")
print("\t\t9. To update maths
marks")
print("\t\t0. To go back to
mainmenu")
choice=int(input("Enter your
choice: "))
if choice==1:
name=input("Enter name: ")
updatedetail(regno,"name",2,name)
21 | P a g e
elif choice==2:
cls=input("Enter class: ")
updatedetail(regno,"class",1,cls)
elif choice==3:
gender=input("Enter gender
(male/female): ")
updatedetail(regno,"gender",2,gender)
elif choice==4:
address=input("Enter address:
")
updatedetail(regno,"address",2,address)
elif choice==5:
contact=input("Enter contact
no.: ")
updatedetail(regno,"contact",2,contact)
elif choice==6:
22 | P a g e
dob=input("Enter date of
birth(yyyy-mm-dd): ")
updatedetail(regno,"dob",2,dob)
elif choice==7:
pm=input("Enter physics
marks: ")
updatedetail(regno,"pm",1,pm)
elif choice==8:
cm=input("Enter chemistry
marks: ")
updatedetail(regno,"cm",1,cm)
elif choice==9:
mm=input("Enter maths
marks: ")
updatedetail(regno,"mm",1,mm)
elif choice==0:
break
23 | P a g e
except Exception as e:
print("Error",e)
def
updatedetail(regno,field,dtype,newvalue):
try:
if mydb.is_connected():
mycursor=mydb.cursor()
if dtype==1:
sql="Update Students Set
"+field+"="+newvalue+" where
regno="+str(regno)
else:
sql="Update Students Set
"+field+"='"+newvalue+"' where
regno="+str(regno)
mycursor.execute(sql)
mydb.commit()
24 | P a g e
if (mycursor.rowcount!=0):
print("Student record updated
successfully")
else:
print("Student record does not
exists!!!")
except Exception as e:
print("Error",e)
def searchmenu():
try:
while True:
print("\t\
t----------------------------------")
print("\t\t1. Search By RegNo")
print("\t\t2. Search By Name")
print("\t\t3. Search By Class")
25 | P a g e
print("\t\t0. To go back to
mainmenu")
choice=int(input("Enter your
choice: "))
if choice==1:
searchstudent("regno")
elif choice==2:
searchstudent("name")
elif choice==3:
searchstudent("class")
elif choice==0:
break
except Exception as e:
print("Error",e)
def searchstudent(field):
try:
if mydb.is_connected():
26 | P a g e
mycursor=mydb.cursor()
value=input("Enter value to
search:")
if field == "Name":
sql="Select * From Students
Where %s='%s'" %(field,value)
else:
sql="Select * From Students
Where %s='%s'" %(field,value)
mycursor.execute(sql)
records = mycursor.fetchall()
if mycursor.rowcount!=0:
count=0
for record in records:
displayrecord(record)
count=count+1
if count%3==0:
27 | P a g e
ch=input("Press any key to
continue")
mydb.commit()
except Exception as e:
print("Error",e)
def displayrecord(rec):
try:
print("Reg No: ",rec[0],"\tName:
",rec[1],"\t\tClass: ",rec[2],"\tGender:
",rec[3])
print("Address: ",rec[4])
print("Contact No: ",rec[5],"\tBirth
Date: ",rec[6])
print("Physics: ",rec[7],"\tChemistry:
",rec[8],"\tMaths: ",rec[9],"\tTotal: ",
(rec[7]+rec[8]+rec[9]),"\tPercent: ",
(rec[7]+rec[8]+rec[9])/3)
28 | P a g e
print("-------------------------------------------
---------------------------------------------------
-----")
except Exception as e:
print("Error",e)
def deletestudent():
try:
regno=int(input("Enter Student
Registration No:"))
if mydb.is_connected():
mycursor=mydb.cursor()
sql="Delete From Students where
regno="+str(regno)
mycursor.execute(sql)
mydb.commit()
if (mycursor.rowcount!=0):
29 | P a g e
print("Student record deleted
successfully")
else:
print("Student record does not
exists!!!")
except Exception as e:
print("Error",e)
def showallresult():
try:
if mydb.is_connected():
mycursor=mydb.cursor()
sql="Select
regno,name,class,gender,contact,dob,pm,cm,
mm,(pm+cm+mm)/3 From Students Order
By RegNo"
mycursor.execute(sql)
records = mycursor.fetchall()
30 | P a g e
colnames=["RegNo","Name","Class","Gender
","Contact","BirthDate","Physics","Chemistry"
,"Maths","Percent"]
if mycursor.rowcount!=0:
## print("RegNo StudentName
Class Gender ContactNo. BirthDate
PM CM MM Percent")
##
print("-------------------------------------------
---------------------------------------------------
----------------------")
## for rec in records:
## print("%-9s"%rec[0],"%-
15s"%rec[1],"%-9s"%rec[2],"%-
10s"%rec[3],"%-14s"%rec[4],"%-
13s"%rec[5],"%-6s"%rec[6],"%-
6s"%rec[7],"%-6s"%rec[8],"%-7s"%rec[9])
print(tabulate(records,
headers=colnames, tablefmt="grid",
showindex="always"))
31 | P a g e
else:
print("No records exists")
except Exception as e:
print("Error",e)
def showall():
try:
if mydb.is_connected():
mycursor=mydb.cursor()
sql="Select * From Students Order
By RegNo"
mycursor.execute(sql)
records = mycursor.fetchall()
if mycursor.rowcount!=0:
count=0
for record in records:
displayrecord(record)
32 | P a g e
count=count+1
if count%5==0:
ch=input("Press any key to
continue")
except Exception as e:
print("Error",e)
def showorderwise():
try:
print("Specify Sort Order")
print("1. Display classwise")
print("2. Display namewise")
print("3. Display percentwise")
choice=int(input("Enter your choice: "))
if choice==1:
orderfield="class"
elif choice==2:
33 | P a g e
orderfield="name"
elif choice==3:
orderfield="percent"
if mydb.is_connected():
mycursor=mydb.cursor()
if orderfield=="percent":
sql="Select * From Students
Order By (pm+cm+mm)/3"
else:
sql="Select * From Students
Order By "+orderfield
mycursor.execute(sql)
records = mycursor.fetchall()
if mycursor.rowcount!=0:
count=0
for record in records:
displayrecord(record)
34 | P a g e
count=count+1
if count%5==0:
ch=input("Press any key to
continue")
except Exception as e:
print("Error",e)
def showtopper():
try:
print("\t\t\t\t\t\tTOPPER DETAILS")
print("-------------------------------------------
---------------------------------------------------
------------------------")
if mydb.is_connected():
mycursor=mydb.cursor()
sql="Select * From Students Where
(pm+cm+mm) in (Select max(pm+cm+mm)
From Students)"
35 | P a g e
mycursor.execute(sql)
records = mycursor.fetchall()
if mycursor.rowcount!=0:
count=0
for record in records:
displayrecord(record)
count=count+1
if count%3==0:
ch=input("Press any key to
continue")
except Exception as e:
print("Error",e)
print("\tMM MM MMMMMMM MM
MMMMMM MMMMMM MMMMMMMMMM
MMMMMMM")
36 | P a g e
print("\tMM MM MM MM MM MM
MM MM MM MM MM ")
print("\tMM MM MM MMMMM MM MM
MM MM MM MM MM MMMMM ")
print("\tMM MM MM MM MM MM
MM MM MM MM MM ")
print("\tMMMMMMMMMM MMMMMMM
MMMMMMM MMMMMM MMMMMM MM MM
MMMMMMM ")
print("\t\t\t SSSSSSSS SSSSSS ")
print("\t\t\t SS SS SS ")
print("\t\t\t SS SS SS ")
print("\t\t\t SS SS SS ")
print("\t\t\t SS SSSSSS ")
print("\tCOMPUTER PROJECT (********
<<STUDENT MANAGEMENT SYSTEM>>
*******)")
print("\t\t press any KEY???? to continue:
")
37 | P a g e
try:
mydb=mysql.connector.connect(host="localh
ost",user="root",passwd="root",database='s
chool')
choice=input("Initialize Database (y/n):")
if choice.lower()=='y':
uname=input("Enter username:")
pwd=input("Enter password:")
if uname=="stum" and
pwd=="sonmah":
mycursor=mydb.cursor()
#mycursor.execute("create database
if not exists school")
#mycursor.execute("use school")
mycursor.execute("Create table if
not exists Users(User varchar(20) primary
key, password varchar(20))")
38 | P a g e
mycursor.execute("Create table if
not exists Students(regno int primary
key,name varchar(25),class int,gender
varchar(10),address varchar(100),contact
varchar(10),dob date,pm int,cm int, mm
int)")
print("Initialized....")
usermenu()
else:
print("Authentication failed")
else:
mycursor=mydb.cursor()
mycursor.execute("use school")
usermenu()
except Exception as e:
print("Error",e)
39 | P a g e
SCOPE OF THE PROJECT
The project can further be improvised using tkinter
module functions. This will help to integrate Graphical
User Interface while adding or viewing student records
to make it more user friendly and visually appealing.
Further validation checks can be implemented in
various modules to make the system more robust and
error prone.
The Student Management System (SMS) project in
Python is envisioned to streamline and automate
critical processes within educational institutions.
Employing Python as the primary programming
language, the system aims to centralize student
information management, automate tasks like
registration, attendance tracking, and grading, and
implement role-based access controls for administrators,
teachers, students, and parents. The project will
leverage Python libraries for real-time reporting,
seamless communication, and efficient course/class
49 | P a g e
management. The technology stack includes Python,
SQLite or MySQL for databases, and Tkinter or
Django for the user interface. The project timeline
spans planning, development, testing, and deployment,
with regular evaluations to ensure alignment with
objectives. The team comprises a Project Manager,
Python Developers, Database Administrator, Quality
Assurance Tester, and Technical Support personnel,
collectively working to deliver a robust and efficient
Student Management System tailored to the
educational institution's needs.
50 | P a g e
BIBLIOGRAPHY
COMPUTER SCIENCE IN PYTHON BY :–
1. SUMITA ARORA, Dhanpatrai Publication
2. PREETI ARORA, Sultan Chand Publication
Websites:
3. www.icbse.com
4. www.cbse.nic.in
5. h ps://www.w3schools.com/python/
6. h ps://www.tutorialspoint.com/python/index.htm
51 | P a g e