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([1,2,3,4,5,6,7,8,9,10,15,20],5))

Output :

(True, 4)

Add a Comment

Add a Comment