Python : Compare two arrays and get the differences

Unhandled Perfection
Unhandled —Dev
Published in
1 min readFeb 9, 2018
arr1 = ['A', 'B', 'C', 'D', 'E']
arr2 = ['A', 'C', 'E']
# Get items in arr2 not in arr1
# output: []
list(set(arr2) - set(arr1))
# Get items in arr1 not in arr2
# output: ['B', 'D']
:list(set(arr1) - set(arr2))

--

--