input: Write a function to find duplicate elements in a list using a loop.
  assert find_duplicates([1, 2, 2, 3, 4, 4, 5])==[2, 4]
  assert find_duplicates([10, 20, 20, 30, 30, 30, 40])==[20, 30]
  assert find_duplicates([5, 5, 5, 5, 5, 5, 5])==[5]
output: def find_duplicates(lst):
      duplicates = []
      seen = set()
      for item in lst:
          if item in seen and item not in duplicates:
              duplicates.append(item)
          else:
              seen.add(item)
      return duplicates