input: Write a function to optimize the given linear_search function using best practices. If the element is found, return its index, otherwise return -1. If the given array is empty, return -1.
  assert linear_search([1, 2, 3, 4, 5], 3)==2
  assert linear_search([1, 2, 3, 4, 5], 6)==-1
  assert linear_search([], 3)==-1
output: def linear_search(arr, target):
      if not arr:
          return -1
      for i, value in enumerate(arr):
          if value == target:
              return i
      return -1