#Write a python menu driven code to perform write, read and update operations on
[Link]
import pickle
def Write():
f=open('[Link]','ab')
ans='y'
while ans=='y':
rno=input('Enter Roll Number:')
name=input('Enter Name:')
marks=input('Enter Marks:')
st=[rno,name,marks]
[Link](st, f)
ans=input('Want to add more records?(y/n):')
[Link]()
def Read():
f=open('[Link]','rb')
while True:
try:
st=[Link](f)
print(st)
except EOFError:
break
[Link]()
def Update(r,m):
f=open('[Link]','rb+')
try:
while True:
pos=[Link]()
st=[Link](f)
if st[0]==r:
st[2]=m
[Link](pos)
[Link](st,f)
break
except Exception:
[Link]()
while True:
print('BINARY OPERATIONS')
print('1. Write')
print('2. Read')
print('3. Update')
print('4. Exit')
ch=int(input('Enter Choice:'))
if ch==1:
Write()
elif ch==2:
Read()
elif ch==3:
rn=input('Enter roll number to be updated:')
m=input('New marks')
Update(rn, m)
elif ch==4:
break
else:
print('Invalid choice')
OUTPUT: