Symmetric Difference

Find elements in either array but not in both (exclusive OR).

Code

General
set_a, set_b = set(arr1), set(arr2)
[x for x in arr1 if x not in set_b] + [x for x in arr2 if x not in set_a]

Parameters

First array

Second array

Server

More Python Snippets