CS Main
CS Main
DBMS:
• The software requires for management of data is
called DBMS. It has three models.
Software Specifications:-
• Operating system : Windows 10/8/7 or higher
• Platform : Python IDLE 3.12.4
• Database : MySQL
• Languages : Python
Hardware Specifications:-
• Processor : Dual core or above
• Hard Disk : 40 GB
• RAM : 1024 MB
Advantages of Project:
1. Saves time of teachers and administrators.
2. eResult display.
3. eResult editing.
4. Effortless grades and marks management.
5. Easy to handle.
FEATURES OF PYTHON:-
#MODULE IMPORT
import mysql.connector as con
#FUNCTION DEFINATIONS
def login_teacher():
cur.execute("Select * from login_teacher;")
x=cur.fetchall()
u_id=input("Enter Teacher ID: ")
password=input("Enter password: ")
for i in x:
if i[0]==u_id and i[1]==password:
print("Login successfull")
break
else:
print("Invalid Teacher ID or password")
def login_student():
cur.execute("Select * from login_student;")
x=cur.fetchall()
u_id=input("Enter Student ID: ")
password=input("Enter password: ")
for i in x:
if i[0]==u_id and i[1]==password:
print("Login successfull")
break
else:
print("Invalid Student ID or password")
def insert_teacher():
u_id=input("Set your user ID: ")
pwd=input("Set your password: ")
x="insert into login_teacher(u_id,pwd)values(%s,%s)"
tup=(u_id,pwd)
cur.execute(x,tup)
db.commit()
print("Account Created!!")
def insert_student():
u_id=input("Set your user ID: ")
pwd=input("Set your password: ")
x="insert into login_student(u_id,pwd)values(%s,%s)"
tup=(u_id,pwd)
cur.execute(x,tup)
db.commit()
print("Account Created!!")
def result_attach():
u_id=input("Enter Student's ID : ")
name=input("Enter Student's name : ")
clas=input("Enter you class: ")
DOB=input("Enter DOB(YYYY-MM-DD): ")
phy=input("Enter Physics marks: ")
math=input("Enter Maths marks: ")
chem=input("Enter Chemistry marks: ")
cs=input("Enter CS marks: ")
eng=input("Enter English marks: ")
x="insert into results(u_id,name,clas,DOB,phy,math,chem,cs,eng)
values(%s,%s,%s,%s,%s,%s,%s,%s,%s)"
tup=(u_id,name,clas,DOB,phy,math,chem,cs,eng)
cur.execute(x,tup)
db.commit()
print("Result Uploaded!!")
def display_result():
l=[1,"NAME: ","CLASS: ","DOB: ","PHYSICS: ","MATHS:
","CHEMISTRY: ","CS: ","ENGLISH: "]
u_id=input("Enter your Student ID: ")
x="select * from results where u_id=%s;"
tup=(u_id,)
cur.execute(x,tup)
result=cur.fetchone()
for i in range(1,9):
print(l[i]+str(result[i]))
def update():
l=[1,"update results set name=%s where u_id=%s;",
"update results set clas=%s where u_id=%s;",
"update results set DOB=%s where u_id=%s;",
"update results set phy=%s where u_id=%s;",
"update results set math=%s where u_id=%s;",
"update results set chem=%s where u_id=%s;",
"update results set cs=%s where u_id=%s;",
"update results set eng=%s where u_id=%s;"]
print("1:Name\n2:Class\n3:DOB(YYYY-MM-DD)\n4:Physics\n5:
Math\n6: Chemistry\n7: CS\n8: English")
change=int(input("Enter your choice: "))
u_id=input("Enter Student's ID where you want to change: ")
new=input("Enter new record: ")
y=str(l[change])
tup=(new,u_id)
cur.execute(l[change],tup)
db.commit()
print("Result updated!!")
def delete():
u_id=input("Enter the Student's ID to delete result: ")
x="delete from results where u_id=%s"
tup=(u_id,)
cur.execute(x,tup)
db.commit()
print("Result Deleted Successfully")
#MAIN
db=con.connect(host="localhost",user="root",password="Veer@_61
2",database="cspractical")
cur=db.cursor()
print("WELCOME")
while True:
print(" \n1 -> TEACHER\n2 -> STUDENT\n3 -> EXIT\n ")
z=int(input("Enter your choice: "))
if z==1:
while True:
print(" \nFOR TEACHERS\n1 -> LOGIN\n2 -> CREATE
ACCOUNT\n3 -> EXIT\n ")
x=int(input("Enter your choice: "))
if x==1:
login_teacher()
while True:
print(" \n1 -> UPLOAD RESULT\n2 -> EDIT RESULT\n3
-> DELETE RESULT\n4 -> DISPLAY RESULT\n5 -
> EXIT\n ")
result=int(input("Enter your choice: "))
if result==1:
result_attach()
elif result==2:
update()
elif result==3:
delete()
elif result==4:
display_result()
elif result==5:
break
else:
print("Invalid choice")
elif x==2:
insert_teacher()
break
elif x==3:
break
else:
print("Invalid choice")
elif z==2:
while True:
print(" \nFOR STUDENTS\n1 -> LOGIN\n2 -> CREATE
ACCOUNT\n3 -> EXIT\n ")
x=int(input("Enter your choice: "))
if x==1:
login_student()
while True:
print(" \n1 -> DISPLAY RESULT\n2 -> EXIT\n ")
result=int(input("Enter your choice: "))
if result==1:
display_result()
elif result==2:
break
else:
print("Invalid choice")
elif x==2:
insert_student()
break
elif x==3:
break
else:
print("Invalid choice")
elif z==3:
break
else:
print("Invalid choice")
MYSQL TABLES:
DETAIL OF TABLES:
TABLES WITH VALUES:
DATA ENTRIES:
• KIPS Textbook
• Respected Subject Teacher