Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

COMPUTER PROJECT

𝟸𝟶𝟸𝟸-𝟸𝟹

𝙿𝚁𝙴𝚂𝙴𝙽𝚃𝙴𝙳 𝙱𝚈
Manas Mishra
XII A2
Roll:- 22
AISSCE ROLL :-
ACKNOWLEDGEMENT
I would like to express my immense
gratitude to my computer teacher Mr.
Tanmoy Paul, for the help and guidance he
provided for completing this project. I would
also like to thank my parents who gave their
ideas and inputs in making this project.
Most of all I thank my school management
for providing us the facilities and
opportunity to do this project. Their support
made this project successful.
CERTIFICATE
This is to certify that Manas Mishra AISSCE
Roll no. Of Class XII A2 has
successfully completed the project. Title of
the project for the subject Computer Science
083 under the supervision guidance of Mr.
Tanmoy Paul for the session 2022-23.

Internal Examiner External Examiner


Content Table :-
Sl. No. Topic Name Page No.

1. Requirements 05

2. User Defined Functions 06

3. Menu Tree 07

4. Source Code 08-16

5. Output 17-22

6. Bibliography 23
REQUIREMENTS
This project can run on any device in which the
following minimum requirements are met:
- Python 3.0 or later must be installed
- Spreadsheet software to manipulate binary file
- 12 GB free storage space
- 4 GB RAM
- Windows 8.1,10 or 11
Software used in this project Python
V3.9.6 and IDLE (Python 3.9)
USER DEFINED FUNCTIONS

def create () : used to enter records


def read() : used to read records
def find() : used for find record
def update() : used for modifying record
def copy() : copy record into new file
def delete() : used to delete a record
Flow Chart start

ans=int(input("Enter
Choice:"))
F If
T
ans create()
=1

F if T
ans= read()
2

F If
T
ans find()
=3

print(“inv F If T
alid updat
ans=
choice”) e()
4

F If
T
ans= copy()
5

F If T
ans= delete()
6

F if T You
ans entered quit,
thankyou
=7

stop
SOURCE CODE :-
import pickle
import os
def create():
f=open('E.BIN','wb')
s=[]
ans='y'
while ans in 'yY':
sn=input("enter student name:")
srol=int(input("enter roll no:"))
m1=int(input("enter admin number:"))
m2=input("enter DOB:")
sp=input("enter stream:")
s=[sn,srol,m1,m2,sp]
pickle.dump(s,f)
ans=input("write more?.. (y/n)?")
f.close()
def read():
stu=[]
rb=open("E.BIN","rb")
print("
studentname\trollno\tAdm_no\tDOB\t\tstream")
try:

while True:
stu=pickle.load(rb)
for i in stu:
print(i,end="\t")
print()
except EOFError:
rb.close()

def find():
rb=open("E.BIN","rb")
n=int(input("enter roll no to be searched="))
try:
while True:
e=[]
e=pickle.load(rb)
if e[1]==n:
print(e);break
except EOFError:
pass
rb.close()

def update():
f=open("E.BIN",'rb+')
r=int(input("Enter Roll no tomodify:"))
flag=False
try:
while True:
p=f.tell()
rec=pickle.load(f)
if rec[1]==(r):
print(rec)
ch=input("wish to change DOB?...((y/n)")
if ch in "yY":
rec[3]=input("Enter new DOB:")
f.seek(p)
pickle.dump(rec,f)
flag=True
except EOFError:
f.close()
if flag:
print("Record found and updated")
else:
print("Record not found")
def copy():
fn=input("enter new file name:")
f1=open("E.BIN","rb")
f2=open(fn,"wb+")
d1={}
print("record copied in new file:")
try:
while True:
d=pickle.load(f1)
pickle.dump(d,f2)
except:
pass
f1.close()
f2.seek(0)
try:
while True:
d1=pickle.load(f2)
print(d1)
except:
pass
f2.close()

def delete():
f=open("E.BIN",'rb')
f1=open("temp.dat",'ab+')
en=int(input("Enter roll no to be removed -->>"))
try:
while True:
r=pickle.load(f)
if r[1]==en:
pickle.dump(r,f1)
print("record removed")
except:
pass
f.close()
f1.close()
os.remove("E.BIN")
os.rename("temp.dat","E.BIN")

while True:
print("Students data handling:")
print("options:")
print("1) Enter Data")
print("2) Display record:")
print("3) Search Data:")
print("4) Modify Record:")
print("5) Copy File:")
print("6) Delete Data:")
print("7) Quit")
ans=int(input("Enter Choice:"))
if ans==1:
create()
elif ans==2:
read()
elif ans==3:
find()
elif ans==4:
update()
elif ans==5:
copy()
elif ans==6:
delete()
elif ans==7:
print("you entered quit,Thank you")
break
else:
print("invalid choice")
continue
Output Code :-
Students data handling:
options:
1) Enter Data
2) Display record:
3) Search Data:
4) Modify Record:
5) Copy File:
6) Delete Data:
7) Quit
Enter Choice:1
enter student name:Swadha
enter roll no:1
enter admin number:16789
enter DOB:17.10.2004
enter stream:pure sci
write more?.. (y/n)?y
enter student name:Pinki
enter roll no:2
enter admin number:12340
enter DOB:14.7.2004
enter stream:pure sci
write more?.. (y/n)?y
enter student name:Manas
enter roll no:3
enter admin number:12345
enter DOB:18.5.2004
enter stream:pure sci
write more?.. (y/n)?n
Students data handling:
options:
1) Enter Data
2) Display record:
3) Search Data:
4) Modify Record:
5) Copy File:
6) Delete Data:
7) Quit
Enter Choice:2
name rollno Adm no DOB stream
Swadha 1 16789 17.10.2004 pure sci
Pinki 2 12340 14.7.2004 pure sci
Manas 3 12345 18.5.2004 pure sci
Students data handling:
options:
1) Enter Data
2) Display record:
3) Search Data:
4) Modify Record:
5) Copy File:
6) Delete Data:
7) Quit
Enter Choice:3
enter roll no to be searched=2
['Pinki', 2, 12340, '14.7.2004', 'pure sci']
Students data handling:
options:
1) Enter Data
2) Display record:
3) Search Data:
4) Modify Record:
5) Copy File:
6) Delete Data:
7) Quit
Enter Choice:4
Enter Roll no to modify:1
['Swadha', 1, 16789, '17.10.2004', 'pure sci']
wish to change DOB?...((y/n)y
Enter new DOB:14.10.2004
Record found and updated
Students data handling:
options:
1) Enter Data
2) Display record:
3) Search Data:
4) Modify Record:
5) Copy File:
6) Delete Data:
7) Quit
Enter Choice:5
enter new file name:new record
record copied in new file:
['Swadha', 1, 16789, '14.10.2004', 'pure sci']
['Pinki', 2, 12340, '14.7.2004', 'pure sci']
['Manas ', 3, 12345, '18.5.2004', 'pure sci’]
Students data handling:
options:
1) Enter Data
2) Display record:
3) Search Data:
4) Modify Record:
5) Copy File:
6) Delete Data:
7) Quit
Enter Choice:6
Enter roll no to be removed -->>3
record removed
Students data handling:
options:
1) Enter Data
2) Display record:
3) Search Data:
4) Modify Record:
5) Copy File:
6) Delete Data:
7) Quit
Enter Choice:2
name rollno Adm_no DOB stream
Swadha 1 16789 14.10.2004 pure sci
Pinki 2 12340 14.7.2004 pure sci
Students data handling:
options:
1) Enter Data
2) Display record:
3) Search Data:
4) Modify Record:
5) Copy File:
6) Delete Data:
7) Quit
Enter Choice:7
you entered quit,Thank you
BIBLIOGRAPHY
1. http://www.google.com/
2. http://en.wikipedia.org
3. Computer science with python by Sumita
Arora

You might also like