import csv def add(): f=open('book.csv','a',newline='\n') d=csv.writer(f) d.writerow(['bookno','bookname','author','price']) while True: bookno=input('enter bookno') bname=input('enter book name') author=input('enter author') price=input('enter price') d.writerow([bookno,bname,author,price]) ch=input('want to add more? y/n') if ch=='n': break f.close() def show(): f=open('book.csv','r') d=csv.reader(f) for i in d: print(i) f.close() def search(p): f=open('book.csv','r') d=csv.reader(f) next(d) for i in d: if int(i[3])>=p: print(i) f.close() f.close() while True: print('1.ADD Book ') print('2.Show all Books') print('3.Search Book') print('4 Exit') ch=int(input('enter choice')) if ch==1: add() elif ch==2: show() elif ch==3: n=int(input('enter price for book search')) search(n) elif ch==4: break ''' OUTPUT 1.ADD Book 2.Show all Books 3.Search Book 4 Exit enter choice1 enter bookno1 enter book nameinformation enter authork l sharma enter price560 want to add more? y/ny enter bookno2 enter book nametechnology enter authors k arora enter price700 want to add more? y/ny enter bookno3 enter book namemathematics solver enter authorshiv das enter price400 want to add more? y/nn 1.ADD Book 2.Show all Books 3.Search Book 4 Exit enter choice3 enter price for book search500 ['1', 'information', 'k l sharma', '560'] ['2', 'technology', 's k arora', '700'] 1.ADD Book 2.Show all Books 3.Search Book 4 Exit enter choice2 ['bookno', 'bookname', 'author', 'price'] ['1', 'information', 'k l sharma', '560'] ['2', 'technology', 's k arora', '700'] ['3', 'mathematics solver', 'shiv das', '400'] 1.ADD Book 2.Show all Books 3.Search Book 4 Exit enter choice4 '''