I have 2 lists like this
first = ['A' , 'B' , 'c' , 'd']
second = ['a' , 'b', 'e']
I want in result ['c' , 'd' ,'e'] . as It’s case insensitive and want uncommon from both lists
tried so far :
a, b = list(set(a) - set(b)),
list(set(b) - set(a))
print("list1 : ", a)
print("list2 : ", b)
but not working for case in sensitive
>Solution :
What you want is a difference between the union and the intersection –
(set(map(str.lower, first)) | set(map(str.lower, second))) - (set(map(str.lower, first)) & set(map(str.lower, second)))
Output
{'c', 'd', 'e'}