def sequentialSearch(datalist,item):
pos = 0
found = False
while pos < len(datalist) and not found:
if datalist[pos] == item:
found = True
return pos
else:
pos = pos + 1
return found
'''
datalist = [10,20,30,5,1,7]
item = 7
result = sequentialSearch(datalist,item)
print result
print datalist[result]
'''
def oredersequentialSearch(datalist,item):
pos = 0
found = False
stop = False
while pos < len(datalist) and not found and not stop:
if datalist[pos] == item:
found = True
return pos
elif datalist[pos] > item:
stop = True
else:
pos = pos + 1
return found
datalist = [1,3,5,10,20,30]
print(oredersequentialSearch(datalist,7))