# Linear search
L = eval(input("Enter list of elements : "))
ele = eval(input("Enter element to search : "))
for x in range(0,len(L)):
if(L[x]==ele):
print("Element",ele,"found at position",(x+1))
break
else:
print("Search element",ele,"not present in given list")
No comments:
Post a Comment
Don't be a silent reader...
Leave your comments...
Anu