input: def linear_search(arr, x):
      """Optimize the linear_search function using enumerate to improve readability and efficiency.
      >>> linear_search([5, 3, 1, 2, 4], 2)
      3
      >>> linear_search([9, 7, 5, 3, 1], 8)
      -1
      """
      for index, item in enumerate(arr):
          if item == x:
              return index
      return -1
output:     for index, item in enumerate(arr):
          if item == x:
              return index
      return -1