programming-examples/python/Algorithms/Python program for sequential search.py
2019-11-15 12:59:38 +01:00

14 lines
338 B
Python

def Sequential_Search(dlist, item):
pos = 0
found = False
while pos < len(dlist) and not found:
if dlist[pos] == item:
found = True
else:
pos = pos + 1
return found, pos
print(Sequential_Search([11,23,58,31,56,77,43,12,65,19],31))