I want to get all exclusive elements between all my lists. So if I have 3 lists like:
list1 = [1, 3, 2]
list2 = ["a", 1, 3]
list3 = [2, 0]
My output should be:
['a', 0]
I tried to do symmetric differencing with all of the lists like:
set(list1) ^ set(list2) ^ set(list3)
But this doesn´t work well.
Also I tried:
def exclusive(*lista):
excl = set(lista[0])
for idx in range(len(lista)):
excl ^= set(lista[idx])
return excl
That works the same as the first method but it doesn´t produce what I want.
Then I tried (set(list1) ^ set(list2)) ^ (set(list2) ^ (set(list3))
and found that it's not the same as what I first tried.
EDIT:
I give 3 list as an example but function take undifined number of arguments