In a small village library, books are lended to the members for a period of one week. Details such as name of the book, author, date of purchase, accession number and availability status are stored for each book. Given the details of the ‘n’ books sorted by the accession number of book and an accession number to search, develop an algorithm and write the Python code to perform binary search in the given data. Print ‘Found’ or ‘Not Found’ appropriately.
Input Format
First line contains the number of books in the library, n
Next n*5 lines contains the details of the book in the following order:
name of the book
author of the book
date of purchase of the book
accession number of the book
availability status of the book
Next line contains the accession number of book to be searched ‘n’
Output Format
Print Found or Not Found
CODE 1 (Correct code Incorrect way):
n=int(input())
l=[]
for i in range(n*5):
print(i)
if(i%5 != 3):
a=input()
else:
l.append(int(input()))
a=int(input())
if a in l:
print('Found')
else:
print('Not Found')