0% found this document useful (0 votes)
16 views6 pages

Project

This document describes a simple exam management system that allows users to input student details and grades as an examiner or view personalized reports as a student. It connects to a MySQL database to store login information and student data. The system displays a menu with options to add student details, view a personalized report based on registration number, see a mark list, or quit the program. It handles user authentication and allows adding details like name, marks, calculating averages, and more.

Uploaded by

Vaishnavi
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)
16 views6 pages

Project

This document describes a simple exam management system that allows users to input student details and grades as an examiner or view personalized reports as a student. It connects to a MySQL database to store login information and student data. The system displays a menu with options to add student details, view a personalized report based on registration number, see a mark list, or quit the program. It handles user authentication and allows adding details like name, marks, calculating averages, and more.

Uploaded by

Vaishnavi
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/ 6

# THIS IS A SIMPLE EXAM MANAGEMENT SYSTEM

# you can use it to input student details and grades as an examiner

# or get your report as a student

import mysql.connector as sql

conn=sql.connect(host='localhost',user='root',passwd='dream')

if conn.is_connected()==False:

print('ERROR PYTHON NOT CONNECTED TO SQL')

c1=conn.cursor()

c1.execute("create database if not exists exam")

c1.execute("use exam")

v_sql=("create table if not exists login_info(user varchar(20) primary key,pass varchar(20))")

c1.execute(v_sql)

c1.execute("select *from login_info")

co=c1.fetchall()

if co==[]:

us=input("Enter user name: ")

pa=input("Enter password: ")

v_sq=("insert into login_info values('"+us+"' ,'"+pa+"') ")

print("Enter values ",us,"as user name and ",pa,"as password" )

c1.execute(v_sq)

c1.execute("create table if not exists info(v_reg_no int(100),name varchar(20),f_name


varchar(20),m_name varchar(20),gender char(1),category varchar(20),state varchar(20),city
varchar(20),dob varchar(50),nationality varchar(20),physics int(3),chemistry int(3),biology
int(3),computer int(3),english int(3),total int(3),avg float(5),result char(4),percentage float(5))")

c1.execute("select * from login_info")

dat=c1.fetchall()
user=input("user name: ")

passwd=input("password: ")

if (user,passwd) in dat:

q=1

while q==1 :

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

print("\n**********_CHOOSE YOUR OPTION!!!_**********\n")

print("1: ADD DETAILS (ONLY FOR STAFF)")

print("2: PERSONALISED REPORT")

print("3: MARK LIST")

print("4: QUIT")

ch=input("\nEnter the choice--")

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

if ch=='1':

pawd=input('\n_ENTER PASSWORD_: ')

if pawd=='inspiration':

print("\n\tWELCOME")

c1.execute("select * from info")

v_data=c1.fetchall()

v_count=len(v_data)

v_reg_no=(v_count+1)

print("\nENTER THESE DETAILS(take care to enter it with the first letter in capital and initial
at first):-\n ")

n=input("Enter the Candidate name: ")

f=input("Enter the Father's or Guardian's name: ")

m=input("Enter the Mother's name: ")


g=input("Enter the Gender(M/F/O): ")

cas=input("Enter the Category(General/OBC/ST/SC): ")

s=input("Enter the State: ")

c=input("Enter the City: ")

d=input("Enter the Date of birth(in words also using(DD/MM/YYYY)): ")

nt=input("Enter the Nationality: ")

m_p=int(input("Enter the Physics marks: "))

m_c=int(input("Enter the Chemistry marks: "))

m_b=int(input("Enter the Biology marks: "))

m_co=int(input("Enter the Computer Science marks: "))

m_e=int(input("Enter the English marks: "))

tot=m_p+m_c+m_b+m_co+m_e

avg=round((tot/5),2)

percen=round(((tot/500)*100),2)

if avg>=32:

res='PASS'

else:

res='FAIL'

print("\nRegistered successfully your registeration number is:- ",v_reg_no)

hi="insert into info values({},'{}','{}','{}','{}','{}','{}','{}','{}','{}',{},{},{},{},{},{},{},'{}',


{})".format(v_reg_no,n,f,m,g,cas,s,c,d,nt,m_p,m_c,m_b,m_co,m_e,tot,avg,res,percen)

c1.execute(hi)

conn.commit()

else:

print("YOU ARE NOT A GENUINE USER ACCESS DENIED!!!")

elif ch=='2':
reg=int(input("Enter the registeration number: "))

v_ch="select*from info where v_reg_no={}".format(reg)

c1.execute(v_ch)

data=c1.fetchone()

def gr(m):

if m>=90:

g='A1'

elif 90>m>=80:

g='A2'

elif 80>m>=70:

g='B1'

elif 70>m>=60:

g='B2'

elif 60>m>=50:

g="C1"

else:

g='C2'

return g

print("\
n**************************************************REPORT***************************
**************************************\n")

print("THIS IS TO CERTIFY THAT ",data[1],end=" ")

print(" ROLL NO. ",reg,end=" ")

print (" MOTHER'S NAME ",data[3],end=" ")

print (" FATHER'S OR GUARDIAN'S NAME ",data[2],end=" ")

print(" GENDER ",data[4],end=" ")


print(" CATEGORY ",data[5],end=" ")

print (" FROM ",data[7],end=" ")

print (" OF ",data[6],end=" ")

print(" BORN ON ",data[8],end=" ")

print(" NATIONALITY ",data[9],end=" ")

print("\nHAS ACHIEVED SCHOLASTIC ACHIEVEMENTS AS UNDER :- \n ")

print("________________________________________________________________________________
____________________")

print(" SUBJECT MARKS GRADE")

print(" Physics ",data[10],' ',gr(data[10]))

print(" Chemistry ",data[11],' ',gr(data[11]))

print(" Biology ",data[12],' ',gr(data[12]))

print(" Computer science ",data[13],' ',gr(data[13]))

print(" English ",data[14],' ',gr(data[14]))

print(" TOTAL ",data[15])

print("________________________________________________________________________________
____________________")

print("\n AVERAGE ",data[16],' ',gr(data[16]))

print(" PERCENTAGE ",data[18],"%")

print("\nRESULT: ",data[17])

elif ch=='3':

print("\n********************************************~ MARK
LIST~******************************************************************\n")

ml="select*from info"

c1.execute(ml)
data=c1.fetchall()

print("________________________________________________________________________________
_______________________")

print("RNO.\tNAME\tGENDER\tCATEGORY\tCITY\tSTATE\tD.O.B\tNATIONALITY\tTOTAL\
tPERCENTAGE")

for j in range(len(data)):

print(data[j][0],"\t",data[j][1],"\t",data[j][4],"\t",data[j][5],"\t",data[j][6],"\t",data[j][7],"\
t",data[j][8],"\t",data[j][9],"\t",data[j][15],"\t",data[j][18])

elif ch=='4':

print("QUITTING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")

break

else:

print("INVALID CHOICE PLEASE TRY AGAIN")

else:

print("ERROR: WRONG USERNAME OR PASSWORD!!!!!!!!!!!")

You might also like