Implement a linear search algorithm in Python to find the position of a given element in an array.
def linear_search(arr, element):
    for i in range(len(arr)):
        if arr[i] == element:
            return i
    return -1