input: Write a function to remove duplicates from a list while preserving the order of the elements. The function should return the new list without duplicates.
  def remove_duplicates(my_list):
   return list(dict.fromkeys(my_list))
  
  assert remove_duplicates([1, 2, 3, 4, 3, 2, 1])==[1, 2, 3, 4]
  assert remove_duplicates([1, 1, 2, 2, 3, 3, 4, 4])==[1, 2, 3, 4]
  assert remove_duplicates([4, 3, 2, 1, 1, 2, 3, 4])==[4, 3, 2, 1]
  assert remove_duplicates([])==[]
  assert remove_duplicates([5, 2, 9, 5, 9])==[5, 2, 9]
output: def remove_duplicates(my_list):
      seen = set()
      result = []
      for item in my_list:
          if item not in seen:
              seen.add(item)
              result.append(item)
      return result