You are on page 1of 1

#Linear Search

nlist = [5, 3, 7,5,12,54,21,64,12,32]


print ('List has the items: ',nlist)
searchItem = int (input ('Enter the number you want to find: '))
found = False
for i in range (len(nlist)) :
if nlist[i] == searchItem:
found = True
print(searchItem, ' was found in the list at index', i)
break
if found == False:
print(searchItem, ' was not found in the list!')

You might also like