I want a code that deletes all instances of any number that has been repeated from a list.
E.g.:
Inputlist = [2, 3, 6, 6, 8, 9, 12, 12, 14]
Outputlist = [2,3,8,9,14]
I have tried to remove the duplicated elements in the list already (by using the "unique" function), but it leaves a single instance of the element in the list nevertheless!
seen = set()
uniq = []
for x in Outputlist:
if x not in seen:
uniq.append(x)
seen.add(x)
seen
I went through a lot of StackOverflow articles too, but all of them differ in the idea that they are searching for removing common elements from two different lists, or that they want just one instance of each element to still be kept. I want to simply remove all common elements.