Code:
Note:- Scroll horizontally to see the full line of code.
def linear_search(a,target):
# a is list of intergers and target is key element to be searched
for i in range(len(a)):
if(a[i]==target):
print(target,"is present at index",i)
break
else:
print(target,"not found in list")
Comments
Post a Comment