Create a linear search algorithm in Python that returns the index of a target item in the list.
def linear_search(arr, target):
    for i in range(len(arr)):
        if arr[i] == target:
            return i
    return -1