#------------------------------------------------------------------------------
# LinearSearch.py
#------------------------------------------------------------------------------

def LinSearch(x, L):
   for i in range(len(L)):
      if x == L[i]:
         return i
      # end if
   # end for 
   # if this line is reached, None is returned
# end LinSearch()


#-- main program --------------------------------------------------------------

target = 'eight'
words = ['one','two','three','four','five','six','seven','eight','nine','ten']

position = LinSearch(target, words)
print(target, 'found at position', position)

target = 50
numbers = [3, -2, 50, 78, 5, 50]

position = LinSearch(target, numbers)
print(target, 'found at position', position)

target = 12
position = LinSearch(target, numbers)
print(target, 'found at position', position)
