-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcs21.py
More file actions
37 lines (37 loc) · 807 Bytes
/
cs21.py
File metadata and controls
37 lines (37 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'''import pickle
def write():
f=open('record','wb')
r=[]
while True:
name=input("enter name")
marks=int(input("enter marks"))
rollno=int(input("enter roll no."))
record=[name,marks,rollno]
r.append(record)
ch=input('continue?')
if ch=='n':
break
pickle.dump(r,f)
f.close()
write()
def read():
import pickle
f=open('record','rb')
r=pickle.load(f)
for i in r:
print(i)
f.close()
read()'''
def search():
flag=0
import pickle
f=open('record','rb')
r=pickle.load(f)
n=input("enter name u want to search")
for i in r:
if i[0]==n:
print("found")
flag=1
if flag==0:
print("not found")
search()