Suggest a completion for the following Python code snippet that implements a linear search on an array.
def linear_search(arr, target):
    for i in range(len(arr)):
def linear_search(arr, target):
    for i in range(len(arr)):
        if (arr[i] == target):
            return i
    return -1