Ip Project File
Ip Project File
Page | 1
CERTIFICATE
Page | 2
ACKNOWLEDGEMENT
Page | 3
Index
Sno particulars Remarks
1. Source code
2. Output
screen
3. System
requirement
4. requirement
5. Biblio-
graphy
Introduction
Page | 4
This project is all about a software for School. It helps
the Teachers to manage
students details. It adds a student, updates an existing
student's details and on course
display details of student and store data in csv file that
can later be accessed using spreadsheet applications like
Ms Excel.
Source code:
import os
Page | 5
import csv
def addrecord():
print("Add a new Record")
print("================")
f=open('students.csv','a',newline='\
r\n')
s=csv.writer(f)
rollno=int(input('Enter rollno='))
name=input('Enter name=')
marks=float(input('Enter marks='))
rec=[rollno,name,marks]
s.writerow(rec)
f.close()
print("Record Saved")
input("Press any key to continue..")
def modifyrecord():
print("Modify a Record")
print("================")
f=open('students.csv','r',newline='\
r\n')
f1=open('temp.csv','w',newline='\r\
n')
f1=open('temp.csv','a',newline='\r\
n')
r=input('Enter rollno you want to
modify')
s=csv.reader(f)
s1=csv.writer(f1)
for rec in s:
if rec[0]==r:
print("Rollno=",rec[0])
print("Name=",rec[1])
print("Marks=",rec[2])
Page | 6
choice=input("Do you want to
modify this record(y/n)")
if choice=='y' or
choice=='Y':
rollno=int(input('Enter
New rollno='))
name=input('Enter new
name=')
marks=float(input('Enter
new marks='))
rec=[rollno,name,marks]
s1.writerow(rec)
print("Record Modified")
else:
s1.writerow(rec)
else:
s1.writerow(rec)
f.close()
f1.close()
os.remove("students.csv")
os.rename("temp.csv","students.csv")
input("Press any key to continue..")
def deleterecord():
f=open('students.csv','r',newline='\
r\n')
f1=open('temp.csv','w',newline='\r\
n')
f1=open('temp.csv','a',newline='\r\
n')
r=input('Enter rollno you want to de-
lete')
s=csv.reader(f)
Page | 7
s1=csv.writer(f1)
for rec in s:
if rec[0]==r:
print("Rollno=",rec[0])
print("Name=",rec[1])
print("Marks=",rec[2])
choice=input("Do you want to
delete this record(y/n)")
if choice=='y' or
choice=='Y':
pass
print("Record Deleted")
else:
s1.writerow(rec)
else:
s1.writerow(rec)
f.close()
f1.close()
os.remove("students.csv")
os.rename("temp.csv","students.csv")
input("Press any key to continue..")
def search():
print("Search a Record")
print("===================")
f=open('students.csv','r',newline='\
r\n') #Remove new line character from
output
r=input('Enter rollno you want to
search')
s=csv.reader(f)
for rec in s:
if rec[0]==r:
Page | 8
print("Rollno=",rec[0])
print("Name=",rec[1])
print("Marks=",rec[2])
f.close()
input("Press any key to continue..")
def viewall():
print("List of All Records")
print("===================")
f=open('students.csv','r',newline='\
r\n') #Remove new line character from
output
s=csv.reader(f)
i=1
for rec in s:
print(rec[0],end="\t\t")
print(rec[1],end="\t\t")
print(rec[2])
i+=1
f.close()
input("Press any key to continue..")
def mainmenu():
choice=0
while choice!=6:
print("\n")
print("Main Menu")
print("==========")
print("1. Add a new Record")
print("2. Modify Existing Re-
cord")
print("3. Delete Existing Re-
cord")
print("4. Search a Record")
print("5. List all Records")
Page | 9
print("6.Exit")
choice=int(input('Enter your
choice'))
if choice==1:
addrecord()
elif choice==2:
modifyrecord()
elif choice==3:
deleterecord()
elif choice==4:
search()
elif choice==5:
viewall()
elif choice==6:
print("Software Terminated")
break
mainmenu()
Output of code:
Page | 10
Working of program:
Page | 11
Page | 12
Page | 13
Excel data table :
Page | 14
Excel table:
Page | 15
Page | 16
Page | 17
System requirement of project
Page | 18
Bibliography
Youtube
https://www.youtube.com/watch?
v=nrdUTeAhepM
www.scribd.com
www.google.com
Page | 19