I have two lists
a = [1,1,2,3]
b = [1,2]
I need a new list c to have the answer which is derived by removing common elements of list b from list a. Which means if b has 1,2 then after removing from a the new list should have 1,3 as elements.
[1,3]
I tried
d = set(a) & set(b)
c = set(a) - d
print c
but I got
[3]
instead of
[1,3]
I know this is because the moment i do set(a) the repeated elements are trucncated and I am left with only one copy of all elements in there.
But my problem is that I want the repeated elements should not be removed.
What to do?