Sample Project File-1
Sample Project File-1
PREPARED BY SUBMITTED TO
S.No. Particulars Page No.
1 Certificate 1
2 Acknowledgement 2
3 About Python 3
4 Description of Project 4
6 Outputs 13-17
This is to certify that Miss KHUSHI SHARMA and Miss SNEHA YADAV
of class XII Commerce have successfully completed this Informatics
Practices Project titled
__________________ __________________
Internal Examiner External Examiner
Surendra Singh
DAV Fertilizer Public School
Babrala
____________________
Principal's Signature
Page-1
The submission of this project work provides us with a great opportunity to
look back and thank all those who have been directly and indirectly
associated in completion of this project work. Mr. Surendra Singh, our
Informatics Practices teacher particularly as a great source of inspiration
for us.
We are also very much thankful to our Principal Sir, Mr. Anand Swaroop
Saraswat for providing us conducive environment and moral support to
complete the project wok.
Page-2
Python 3.7.0 is the newest major release of the Python language, and it
contains many new features and optimizations. Among the major new
features in Python 3.7 are: PEP 539, new C API for thread-local storage
PEP 545, Python documentation translations.
Page-3
A student information system is a software application for managing
details and records of the students.
Considering the need of the present scenario, this project has been made to
facilitate the registration on computer system for fast accessing of the
records as and when required. This project has been designed to meet the
following requirements………
Page-4
#------------------------------------------------------------------------------------------------------------------
# Python-MySQL Connection
#------------------------------------------------------------------------------------------------------------------
import mysql.connector
mydb=mysql.connector.connect(host="localhost",\
user="root",\
passwd="tcdav",\
database="school")
mycursor=mydb.cursor()
#------------------------------------------------------------------------------------------------------------------
# Create Table Student FUNCTION
#------------------------------------------------------------------------------------------------------------------
def CreateTable():
try:
mycursor.execute("CREATE TABLE Student \
(AdmnNo INT AUTO_INCREMENT PRIMARY KEY,\
sname VARCHAR(20),\
contact VARCHAR(12),\
house VARCHAR(12),\
class int(10),\
section VARCHAR(12),\
mothername VARCHAR(20),\
fathername VARCHAR(20),\
gender VARCHAR(10),\
category VARCHAR(10),\
address VARCHAR(50),\
cityname VARCHAR(20),\
statename VARCHAR(20),\
bloodgrp VARCHAR(2),\
DOB DATE )")
print("Wow! Table created successfully")
except:
print("Table already created.")
print("Enjoy your project!!!")
print()
r=input("Press any key to continue.....")
Page-5
#------------------------------------------------------------------------------------------------------------------
# Register Student FUNCTION
#------------------------------------------------------------------------------------------------------------------
def Register():
print("----------------Data Entry----------------")
choice='y'
while(choice=='y' or choice=='Y'):
sname=input("Enter student's name? ")
cno=int(input("Enter contact number? "))
house=input("Enter student's house? ")
clas=int(input("Enter student's class? "))
section=input("Enter student's section? ")
mname=input("Enter student's mother name? ")
fname=input("Enter student's father name ? ")
gender=input("Enter student's gender? ")
cate=input("Enter student's category? ")
add=input("Enter student's address? ")
ctname=input("Enter student's city name? ")
statename=input("Enter student's state name? ")
bloodgrp=input("Enter blood group of student?")
dob=input("Enter student' date of birth?")
mycursor = mydb.cursor()
sql="INSERT INTO
Student(sname,contact,house,class,section,mothername,fathername,gender,category,a
ddress,cityname,statename,bloodgrp,
DOB)\
VALUES (%s, %s, %s, %s, %s, %s, %s,%s, %s, %s, %s, %s, %s, %s)"
val =
(sname,cno,house,clas,section,mname,fname,gender,cate,add,ctname,statename,blood
grp,dob)
mycursor.execute(sql, val)
mydb.commit()
print(mycursor.rowcount, "Registration done successfully.")
print()
choice=input("Enter Y or y for more registration? ")
Page-6
#------------------------------------------------------------------------------------------------------------------
# Show All Registration FUNCTION
#------------------------------------------------------------------------------------------------------------------
def ShowAll():
sql="select * from Student"
mycursor.execute(sql)
print()
print()
print("All Registrations")
print()
for row in mycursor:
print(row)
mydb.close()
print()
print(mycursor.rowcount, "records found.")
print()
r=input("Press any key to continue.....")
#------------------------------------------------------------------------------------------------------------------
# SEARCH STUDENT FUNCTION
#------------------------------------------------------------------------------------------------------------------
def SearchStudent():
rn=int(input("Enter Student Admission number? "))
sql = "SELECT * FROM Student WHERE AdmnNo=%s"
mycursor.execute(sql, (rn,))
myresult = mycursor.fetchall()
if myresult != "":
for x in myresult:
print(x)
else:
print("Failed to get record from MySQL table")
mydb.close()
r=input("Press any key to continue.....")
Page-7
#------------------------------------------------------------------------------------------------------------------
# Search Student Category Wise
#------------------------------------------------------------------------------------------------------------------
def Categorywise():
rn=input("Enter Student category? ")
sql = "SELECT * FROM Student WHERE category=%s"
mycursor.execute(sql, (rn,))
myresult = mycursor.fetchall()
if myresult != "":
for x in myresult:
print(x)
else:
print("Failed to get record from MySQL table")
mydb.close()
r=input("Press any key to continue.....")
#------------------------------------------------------------------------------------------------------------------
# Search Student Class Wise
#------------------------------------------------------------------------------------------------------------------
def Classwise():
rn=input("Enter student's class?")
sql="Select * from Student WHERE class=%s"
mycursor.execute(sql,(rn,))
myresult = mycursor.fetchall()
if myresult != "":
for x in myresult:
print(x)
else:
print("OOPS!Failed to get record from MYSQL table")
mydb.close()
r=input("Press any key to continue....")
Page-8
#------------------------------------------------------------------------------------------------------------------
# Search Student Section Wise
#------------------------------------------------------------------------------------------------------------------
def Sectionwise():
rn=input("Enter student's section?")
sql="Select * from Student WHERE section=%s"
mycursor.execute(sql,(rn,))
myresult= mycursor.fetchall()
if myresult != "":
for x in myresult:
print(x)
else:
print("OOPS!Failed to get record...")
mydb.close()
r=input("Press any key to continue....")
#------------------------------------------------------------------------------------------------------------------
# Search Student Housewise
#------------------------------------------------------------------------------------------------------------------
def housewise():
hou=input("Enter student's house?")
sql="Select * from Student WHERE house=%s"
mycursor.execute(sql,(hou,))
myresult= mycursor.fetchall()
if myresult != "":
for x in myresult:
print(x)
else:
print("OOPS!Failed to get record...")
mydb.close()
r=input("Press any key to continue....")
Page-9
#------------------------------------------------------------------------------------------------------------------
# Update Information FUNCTION
#------------------------------------------------------------------------------------------------------------------
def UpdateInformation():
adm=int(input("Enter Admission number to update entry? "))
phno=int(input("Enter contact number? "))
add=input("Enter current address? ")
str="UPDATE Student SET contact=%s,address=%s where AdmnNo=%s"
val=(phno, add, adm)
mycursor.execute(str, val)
mydb.commit()
print()
print(mycursor.rowcount, "record updated successfully.")
print()
r=input("Press any key to continue.....")
#------------------------------------------------------------------------------------------------------------------
# Delete Record FUNCTION
#------------------------------------------------------------------------------------------------------------------
def DeleteStudent():
adm=input("Enter admission number to delete record? ")
mycursor = mydb.cursor()
sql = "DELETE FROM STUDENT WHERE AdmnNo = %s"
val=(adm,)
mycursor.execute(sql, val)
mydb.commit()
print(mycursor.rowcount, "record(s) deleted")
print()
r=input("Press any key to continue.....")
Page-10
#------------------------------------------------------------------------------------------------------------------
# Program Menu Code
#------------------------------------------------------------------------------------------------------------------
while True:
print("--------------------------------------------------------------------------------------------------")
print("********WELCOME TO STUDENT INFORMATION SYSTEM*******")
print("--------------------------------------------------------------------------------------------------")
print(" 1: Create Student Table ")
print(" 2: Register a Student ")
print(" 3: Show All Registered Students ")
print(" 4: Search a Student ")
print(" 5: Search a student category wise ")
print(" 6: Search a student class wise ")
print(" 7: Search a student section wise ")
print(" 8: Search a student house wise ")
print(" 9: Update Student Information ")
print(" 10: Delete a Student Record ")
print(" 11: Exit ")
print("--------------------------------------------------------------------------------------------------")
print()
choice = int(input(" Please enter your choice: "))
if choice == 1 :
CreateTable()
elif choice == 2:
Register()
elif choice == 3:
ShowAll()
elif choice == 4:
SearchStudent()
elif choice == 5:
Categorywise()
elif choice == 6:
Classwise()
elif choice == 7:
Sectionwise()
elif choice== 8:
housewise()
elif choice == 9:
UpdateInformation()
elif choice == 10:
DeleteStudent()
elif choice ==11:
quit()
else:
print("You must only select either 1 to 7")
print("Please try again")
Page-11
Table Creation
Page-12
Register Student
Page-13
All Registrations
Search Student
Page-14
Search Student Category Wise
Page-15
Search Student Section Wise
Page-16
Update Function
Delete function
Page-17