0% found this document useful (0 votes)
15 views31 pages

Cs Project

The document is a project file for a Student Marks Management System developed by Gauri Dutta Mongia as part of her Computer Science coursework at Vivekanand School. It outlines the project's objectives, system implementation details, theoretical background on Python and MySQL, and includes source code for the application. The system aims to automate the management of student marks, providing features like data entry, grade calculation, and report generation.

Uploaded by

neetumongia12345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views31 pages

Cs Project

The document is a project file for a Student Marks Management System developed by Gauri Dutta Mongia as part of her Computer Science coursework at Vivekanand School. It outlines the project's objectives, system implementation details, theoretical background on Python and MySQL, and includes source code for the application. The system aims to automate the management of student marks, providing features like data entry, grade calculation, and report generation.

Uploaded by

neetumongia12345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 31

VIVEKANAND SCHOOL

ANAND VIHAR

COMPUTER SCIENCE
PROJECT FILE
(2024-25)

Student's marks
management
NAME:Gauri dutta
Mongia
CLASS : XII ROLL NO.
:

CERTIFICATE
This is to certify that I, Pragya
mongia a student of class XII has
successfully completed the
PROJECT FILE under the guidance
of Mr tanveer and has followed all
the instructions given by CBSE.

________
________ Internal Examiner
External
ACKNOWLEDGEM
ENT
I would like to express my special
thanks of gratitude to Mr tanveer for
his
constant encouragement and
guidance provided throughout this
project. It helped me learn about a
lot of new
things. I am really thankful to her.

I also express my gratitude to my


project partner who has been
instrumental in the successful
completion of this project.
INDEX
S.NO. CONTENT PAGE

1.
Introduction 5
2. Objective and scope 6
3. System implementation 7

4. Theoretical Background 8-13


5. Modules and Functions 14
6. Source code 15-23
7. Outputs 24-31
8. Bibliography 32
INTRODUCTION
The Student Marks Management System will
manage and store student marks, providing
teachers, administrators, students with easy
access to performance data. Project aims to
automate and streamline the process of
recording, calculating, analyzing student scores
across different subjects and assessments.
KEY FEATURES:
1.DATA ENTRY: Teachers can easily input
student marks for various subjects and
assessments.
2.GRADE CALCULATION: The system
automatically calculates the total marks,
percentages, and assigns corresponding
grades.
3.STUDENT REPORT GENERATION : Detailed
reports are generated, including overall
performance and grades for each subject.
4.SEARCH AND FILTER: Can search for student
records based on specific criteria and filter
results by class, subject, or grade.
5.SECURITY: The system ensures that only
authorized personnel can access and modify
student data.
6.USER INTERFACE: User-friendly interface that
simplifies the input, retrieval, and analysis of
student marks.

OBJECTIVE AND SCOPE


The objective of this program is to develop
software to solve real-world problems and
make life easier using modern programming
skills and tools like python, mysql.
This project is based on dealing with the pile
of
information a user can receive
upon searching for movies and
their details. The proposed
software is expected to
perform the following
functions: # Provide a GUI
based integrated and
centralized environment for
reports
# Provide user based reports # Perform series
of calculations based on user input, to give
the best result of query # Demonstrate the
use and helpfulness of programming in
solving everyday problems

SYSTEM
IMPLEMENTATION
HARDWARE USED:
Device 1 : Lenovo G500 20236, Intel®
Pentium®,CPU 2020M @ 2.40GHz, 4GB RAM,
64 bit OS,x64 based processor Device 2 :
Redmibook 15 Pro, 11th Gen Intel® CORE™
i5 11300H, 3.10GHz, 8GB RAM, 64 bit OS, x64
based processor

SOFTWARE USED:
# Operating system : Windows 10 Home
Single Language # Python IDLE 3.8(64 bit)
as Front-End development environment
#MySQL as Back-End Server with
Database for testing #mysql.connector
to connect python module with
database # MS-Word for documentation
THEORETICAL
BACKGROUND
WHAT IS PYTHON?
Python is an open source, Object-Oriented high
level
programming language developed by Guido-Van
Rossum in 1991 at the National Research
Institute for Mathematics, Netherlands.
Python is a general purpose programming
language that can be used effectively to build
any kind of program.

FEATURES OF PYTHON:
# It is an interactive, Interpreted language
# It is a loosely typed Object-Oriented language
# It is a free open-source and portable language
# It takes less time to develop program
# It supports GUI
# It can be easily compatible with other
languages like C, C++
# It is used for both scientific and non-scientific
programming
ADVANTAGES OF PYTHON:
# Dynamic
# Platform Independent
# Readability
# Object-Oriented
# High Productivity
# Easy to Learn
# GUI based
# Syntax Highlighting

INSTALLING PYTHON :

It can be installed using the website:


https://www.python.org/downloads
Select the version you want to install and click on
download to download the python installer
USING PYTHON:
Using IDLE python programs can be run in two ways: #
SHELL MODE: where you get the output of the
statement in the next line. Using python prompt:
#SCTIPT MODE: where you can save the group of
statements in a file with extension ‘.py’ and run

WHAT IS DATABASE?

them together
A database is defined as an organised collection of
data about entities. DBMS are designed applications
that connect user and program and store data in
organised manner. Using RDBMS that connect user
and program to store data in organised manner.
Using RDMBS application like MySQL, Oracle, Sybase,
etc.

MySQL:
MySQL is an open source and freely available RDBMS
that uses the SQL. It is developed, distributed, and
supported by Oracle corporation.
FEATURES OF MySQL:
#Can retrieve data from database through query
processing.
# It can insert and update records in database
WHAT IS FILE HANDLING?
A file is document stored on permanent storage
device which can be read and rewritten
according to requirement. Data files can be
stored in 3 formats:

#TEXT FILE:
In a text file, the data is stored in sequence of
lines, where each line is a sequence of
characters. The file is stored in ‘.txt’ format. It is
human readable and has an EOL character ‘\n’.
#BINARY FILE:
In a binary file, the data is stored in stream of
bytes. It is used to store data such as video or
audio files. The file is stored in ‘.dat’ format. It is
non-human readable and doesn’t have an EOL
character. #CSV FILE:
In a CSV file, the data is entered in the form of
comma separated values and stored in rows and
columns. It is used to store records. The file is
stored in ‘.csv’ format. It is somewhat human
readable and doesn’t have an EOL character.
USING DATA FILES:
# To handle the data files first we need to assign a file
handle to it.
# We can open the file with open() function using two
methods: f=open() and with open():
# We can open the file with 3 modes: ‘read’, ‘write’ and
‘append’
# Read mode is used to read the file # Methods of reading
text file are: read(), readline(n), readlines()
# Read() is used to select all the data in a file as a single
string
# Readline(n) is used to select a single line as a single string
# Readlines() is used to select all the lines as list of strings
where each string is a line
# Write mode is used to write In the file # Methods of
Writing In a file are: write() and writelines()
# Write() is used to write any content in the file #
Writelines() is used to write multiple lines in a list
# Append mode is used to write at the end of the existing
file
# Then we need to close the file using close() function
# TRY :

A try block is used in programming (primarily in


languages like Python, Java, C++, etc.) to handle
exceptions (errors) that might occur during the
execution of a program. When you want to write
code that might potentially cause an error, you can
wrap it inside a try block.

# EXCEPT:

The except block is used in conjunction with the try


block to handle exceptions (errors) that might occur
during the execution of code. When an error occurs
inside the try block, the program will "jump" to the
except block to handle the error gracefully rather
than crashing.

# It can create new databases and modify existing


# It can create new tables in database
# It can create new views in database
# It allows modifying the security settings of
system

MODULES:
# Time Module: to use sleep function for frontend
working
# CSV Module: to use csv file functions and store
data in csv file
# MySQL.connector Moddule: to add mysql
functions for db connectivity as backend working
FUNCTIONS:
# TIME: sleep()
# CSV: writer(), writerow()
#MYSQL.CONNECTOR:connect(),is_connected(),
cursor(),execute(), fetchall(),format(),commit() #
SQL: max(), min(), sum(), average(), count() # IN-
BUILT: int(), input(), len(), print(), range(), append()

SOURCE CODE
#STUDENTS MARKS MANAGEMENT
import mysql.connector as sql import
sys

#CONNECT TO MYSQL DATABASE


db=sql.connect(host="localhost",user="root",passwd="students"database="mysql")
cursor=db.cursor()

#CHECK DATABASE IS CONNECTED if


db.is_connected(): print("Database
connected")

#MENU FOR STUDENT MARKS MANAGEMENT SYSTEM SOFTWARE


print("*************************************************") print("WELCOME
TO MY PROJECT STUDENT MARKS MANAGEMENT SYSTEM")
print("*************************************************") print() while
True:
print("1:TO CREATE TABLE FOR THE FIRST TIME")
print("2:TO DISPLAY TABLES OF DATABASE") print("3:TO
SHOW FIELDS OF TABLE") print("4:TO DISPLAY ALL
RECORDS OF TABLE") print("5:TO ADD NEW STUDENT")
print("6:TO SEARCH A STUDENT RECORD") print("7:TO
CHANGE MARKS OF STUDENT") print("8:TO DELETE
STUDENT ") print("9:TO CALCULATE GRADE")
print("10:TO LIST ALL MARKS") . print("11:TO LIST ALL
STUDENTS ")
.
print("12: TO VIEW STUDENTS ABOVE CERTAIN PERCENTAGE ") print("13:
TO SORT STUDENTS BY MARKS IN DESCENDING ORDER") print("14: TO RESET
DATABASE") print("15: EXIT")

ch= int(input("ENTER YOUR CHOICE:"))

#CREATING TABLE FOR THE FIRST TIME if


ch==1: try:
print(" Creating STUDENT table")
sql = "CREATE TABLE student(ROLL int(4) PRIMARY KEY, name varchar
NOT NULL,class char(3) NOT NULL,sec char(1),mark1 int(4), mark2 int(4),marks
int(4),mark4 int(4),mark5 int(4),
. total int(4),per float(4));"
cursor.execute(sql) mycon.commit()
except: print("sorry some error
occured")

# DISPLAYING TABLES OF DATABASE if


ch==2: try:
cursor.execute("show tables")
for i in cursor:
print(i) except:
print("sorry some error occured")

#DISPLAYING TABLES FIELDS if


ch==3:

try:
table=input("enter table name")
cursor.execute("desc %s"%table) for i in
cursor:
print(i) except:
print("sorry some error occured")
#DISPLAYING ALL RECORDS OF TABLE if
ch==4: try:
cursor.execute("select * from student") data=cursor.fetchall()
print("RollNo","Studentname","Class","Section",Subject1",
"Subject2","Subject3", "Subject4","Subject5","Total Marks"
"Percentage")
for i in data:
j=str(i).split() for k in j:
print(k,end=" ") print() except:
print("SORRY SOME ERROR OCCURED")

#INSERTING NEW RECORDS INTO TABLE if


ch==5:
r=int(input("Enter student roll number"))
name=input("ENTER STUDENT NAME") c=input("ENTER CLASS
OF STUDENT") s=input("ENTER SECTION OF STUDENT")
m1=int(input("ENTER MARKS IN SUBJECT1"))
m2=int(input("ENTER MARKS IN SUBJECT2"))
m3=int(input("ENTER MARKS IN SUBJECT3"))
m4=int(input("ENTER MARKS IN SUBJECT4"))
m5=int(input("ENTER MARKS IN SUBJECT5"))
t=m1+m2+m3+m4+m5

per=t/5 query="insert ntostudentalues(%d,'%s','%s','%s',%d,%d,%d,%d,%d,%d,%d)"


,%(r,name,c,s,m1,m2,m3,m4,m5,t,per) cursor.execute(query)
print("STUDENT RECORD SAVED IN TABLE") db.commit()

#SEARCHING STUDENT DETAILS if ch==6:


print("1:TO SERACH BY STUDENT ROLL NUMBER") print("2:TO SEARCH BY
STUDENT NAME") c=int(input("ENTER YOUR CHOICE")) #SEARCHING BY STUDENT
ROLL NO. if c==1: try:
roll=int(input("ENTER STUDENT ROLL NUMBER TO SEARCH"))
qry="select * from student where roll=%d"%roll cursor.execute(qry)
data=cursor.fetchall() if len(data)==0:
print("STUDENT NOT FOUND") print ("Roll No" , "Student
name","Class","Section","Subject1",
"Subject2",Subject3","Subject4","Subject5", "Total
Marks","Percentage") for i in data:
j=str(i).split()

for k
in j:
print(k,end=" ") print()
except: print("SORRY SOME ERROR OCCURED")

#TO UPDATE STUDENT MARKS if


ch==7: try:
roll=int(input("ENTER ROLL NUMBER OF STUDENT WHOSE MARKS
. TO BE UPDATE")) qry="select * from
student where roll=%d"%roll" cursor.execute(qry)
data=cursor.fetchall() if len(data)==0:
print("STUDENT NOT FOUND") else:
. m1=int(input("ENTER UPDATED MARKS IN SUBJECT1"))
m2=int(input("ENTER UPDATED MARKS IN SUBJECT2"))
m3=int(input("ENTER UPDATED MARKS IN SUBJECT3"))
m4=int(input("ENTER UPDATED MARKS IN SUBJECT4"))
m5=int(input("ENTER UPDATED MARKS IN SUBJECT5"))
t=m1+m2+m3+m4+m5 per=t/5
qry="updateSTUDENT SET mark1=%d,mark2=%d,mark3=%d, mark4=
%d,mark5=%d,total=%d,per=%d where roll=%d"%
(m1,m2,m3,m4,m5,t,per,roll)
cursor.execute(qry) print("STUDENT RECORD
UPDATED") db.commit() except:
print("SORRY SOME ERROR OCCURED")
# DELETE STUDENT RECORD FROM TABLE if
ch==8: try:
roll=int(input("ENTER STUDENT ROLL NUMBER YOU WANT TO DELETE"))
qry="select * from student where roll=%d"%roll" cursor.execute(qry)
data=cursor.fetchall() if len(data)==0:
print("STUDENT NOT FOUND IN TABLE") else:
qry="delete from student where roll=%d"%(roll)"
cursor.execute(qry) print("STUDENT RECORD DELETED FROM
TABLE") db.commit() except: print("SORRY SOME
ERROR OCCURED")

#CALCULATE GRADE OF STUDENT try:


if ch==9:
roll_number=int(input("Enter roll no. Of student:"))
cursor.execute('''SELECT subject, marks FROM marks WHERE
roll_number = ? ''', (roll_number,)) marks = cursor.fetchall() if
marks:
total_marks = sum(mark for _, mark in marks) percentage
= (total_marks / (len(marks) * 100)) * 100 if percentage >= 90:
grade = 'A' elif
percentage >= 75:
grade = 'B'

elif percentage >= 50:


grade = 'C' else:
grade = 'F' print(f"Total Marks: {total_marks}") print(f"Percentage:
{percentage}%") print(f"Grade: {grade}") except: print("No marks found for
this student")

# LIST ALL MARKS try:


if ch==10:
subject = input("Enter subject to list all marks: ")
cursor.execute('''SELECT students.name, marks.marks FROM marks
JOIN students ON marks.roll_number =students.roll_number WHERE
marks.subject = ? ''', (subject,)) marks = cursor.fetchall() if marks:
print(f"Marks for {subject}:") for name, mark in marks:
print(f"Name: {name}, Marks: {mark}") except: print(f"No marks found for
{subject}.")

# LIST ALL STUDENTS try:


. if ch ==11:
cursor.execute('''SELECT roll_number, name FROM students''') students =
cursor.fetchall() if students:
print("All Students:") for student in students:

print(f"Roll Number: {student[0]}, Name: {student[1]}") except:


print("No students found.")

# VIEW STUDENTS ABOVE CERTAIN PERCENTAGE try:


. if ch ==12: conn =
connect_db() if conn is
None:
return cursor = conn.cursor() percentage = float(input("Enter percentage threshold: "))
query = "SELECT * FROM students WHERE percentage > %s" cursor.execute(query, (percentage,))
rows = cursor.fetchall() for row in rows: print(f"ID: {row[0]}, Name: {row[1]}, Math: {row[2]},
Science: {row[3]}, English: {.
. row[4]}, Total: {row[5]}, Percentage: {row[6]:.2f}%")
cursor.close() conn.close()

# SORT STUDENTS BY MARKS IN DESCENDING ORDER try:


. if ch ==13: conn =
connect_db() if conn is
None:
return cursor = conn.cursor() query = "SELECT * FROM students
ORDER BY total_marks DESC" cursor.execute(query) rows =
cursor.fetchall() for row in rows:
print(f"ID: {row[0]}, Name: {row[1]}, Math: {row[2]}, Science: {row[3]},
English: {row[4]}, Total: {row[5]}, Percentage: {row[6]:.2f}%") cursor.close()
conn.close()
# RESET DATABASE try: if ch==14:
. conn = connect_db() if conn is None:
return cursor = conn.cursor() confirm = input("Are you sure you want to delete all
student records? (yes/no): ") if confirm.lower() == 'yes':
cursor.execute("DELETE FROM students") conn.commit() print("All student records
have been deleted.") except:
print("Operation cancelled.") cursor.close() conn.close()

#EXIT FROM PROGRAM if ch==15: sys.exit()


. print("DATABASE CLOSED")
#INVALID CHOICE else:
. print("CHOICE NOT FOUND")

db.close()

OUTPUT
Choice 1: Create table for first time

Choice 2: Display tables of databases


Choice 3: Show fields of table

Choice 4: Display all records of table


Choice 5: Add new student

Choice 6: Search student record


Choice 7: Change marks of student

Choice 8: Delete student


Choice 9: Calculate grade

Choice 10: List all Marks


Choice 11: List all Students

Choice 12: View student above certain percentage


Choice 13: Sort student's by marks in
descending order

Choice 14: Reset database


Choice 15: Exit and Invalid choice

BIBLIOGRAPHY
To develop this project following
resources are used:
• Computer Science Textbook – Preeti
Arora (Sultan Chand)
• https://www.python.org/
• https://www.mysql.com/

You might also like