i used this code, but this codes only removes the duplicates on the list and returns the list without duplicates for example if i had a = [1,1,2,3,3,4,6]
when i used the bottom codes it giving outputting this a = [1,2,3,4,6]. but i want to only ouput the integer that appears only once ex i want this [2,4,6] can anyone help pleaseee stayed up all night trying to figure this out
def unique(a):
order = set()
order_add = order.add
return [x for x in a if x not in order and not order_add(x)]
To preserve order while removing items with duplicates: