For some reason this python linear search will not work. Every time I run it and input a value that is in the list, it does not tell me that the item is in the list and just runs through. It does not give any syntax error so must be something logical. Any ideas?
def linearSearch():
numbers = [3, 5, 54, 6, 17, 8, 32, 65, 87, 54]
pointer = 0
print("What would you like to search for?")
searchTerm = input()
try:
val = int(searchTerm)
except ValueError:
print("Please enter an integer")
linearSearch()
while pointer < len(numbers):
if numbers[pointer] == searchTerm:
print("Item has been found at " + pointer)
else:
pointer = pointer + 1