Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Do you need a check that duplicates can be in both the first and the second list? If necessary, you need to make two passes:
a=[1,2,3,4,4,4,1,1,3]
b=[2,2,5,10,11,3,3]
out1=[x for x in a if x not in b]
print ('Из А отсеяно то, что дублируется в Б', out1)
out2=[x for x in b if x not in a]
print ('Из Б отсеяно то, что дублируется в А', out2)
print ('Итого',out1+out2)
Из А отсеяны дубликаты из Б [1, 4, 4, 4, 1, 1]
Из Б отсеяны дубликаты из А [5, 10, 11]
Итого [1, 4, 4, 4, 1, 1, 5, 10, 11]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question