input: Write a function to find the maximum element in a given list of integers. If the list is empty, return None. The function should iterate through the list once and return the maximum value found.
  assert max_element([3, 4, 5, 1, 2])==5
  assert max_element([3, 5, 10, 1, 2])==10
  assert max_element([4, 3, 1, 2])==4
  assert max_element([3, 5, 4, 1, 2])==5
  assert max_element([])==None
output: def max_element(lst):
      if not lst:
          return None
      max_val = lst[0]
      for num in lst:
          if num > max_val:
              max_val = num
      return max_val