python linear search code, what’s a better example if a linear search Algorithm?
A few issues with the code above:


Misspelling of variable name in line 1 - linerar_search instead of linear_search
None is the reserved keyword in python, not none. Trying to return none would throw a NameError: name 'none' is not defined
The indent for function verify is off but it shouldn't cause errors.


The code below runs for me:

def linear_search(list, target):
    """ Returns the index position of the target if found, else returns None"""
    for i in range(0, len(list)):
        if list[i] == target:
            return i
        return None

def verify(index):
    if index is not None:
        print("Target found at index: ", index)
    else:
        print("Target not found in list")

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

result = linear_search(numbers, 12)
verify(result)


Hope this helps! :)

P.S: This seems more so like a python problem then data science. Perhaps you could have posted this question in Stackoverflow instead.