Create a function that implements a linear search algorithm in Python.
x = 20
arr = [10, 8, 6, 4 2, 20]
def linearSearch(arr, x): 
    for i in range(len(arr)): 
        if arr[i] == x: 
            return i 
    return -1