input: from typing import List
  
  def linear_search(arr: List[int], x: int) -> int:
      """Perform a linear search on a list to find the index of an element x.
      Returns the index if found, otherwise returns -1.
      >>> linear_search([1, 2, 3, 4], 3)
      2
      >>> linear_search([1, 2, 3, 4], 5)
      -1
      """
output:     for i in range(len(arr)):
          if arr[i] == x:
              return i
      return -1