input: def linear_search_optimized(arr, x):
      """
      Optimized linear search function that uses enumerate for more concise code.
      >>> linear_search_optimized([1, 2, 3, 4, 5], 3)
      2
      >>> linear_search_optimized([1, 2, 3, 4, 5], 6)
      -1
      """
output:     for i, value in enumerate(arr):
          if value == x:
              return i
      return -1