input: def linear_search(arr: List[Any], x: Any) -> int:
      """
      Optimize the linear search algorithm to find the index of x in arr using best practices.
      If x is found, return its index; otherwise, return -1.
      >>> linear_search([1, 2, 3, 4, 5], 3)
      2
      >>> linear_search([1, 2, 3, 4, 5], 6)
      -1
      """
output:     for i in range(len(arr)):
          if arr[i] == x:
              return i
      return -1