input: Write a function to perform a linear search on an array. The function should take in an array and a value to search for, and return the index of the value if it is found, or -1 if it is not.
  assert linear_search([5, 3, 7, 2], 7) == 2
  assert linear_search([5, 3, 7, 2], 1) == -1
  assert linear_search([], 4) == -1
  assert linear_search([1, 2, 3, 4, 5], 3) == 2
  assert linear_search([2, 4, 6, 8, 10], 10) == 4
output: def linear_search(arr, val):
      for i in range(len(arr)):
          if arr[i] == val:
              return i
      return -1