How can I find the duplicates in a Python list and create another list of the duplicates? The list only contains integers.
def removeduplicates(a): seen = set() for i in a: if i not in seen: seen.add(i) return seen print(removeduplicates([1,1,2,2]))