I am trying to find unique values b/w 2 lists but this logic doesn't seems to work
x = [1,2,3,4]
f = [1,11,22,33,44,3,4]
for element in f:
if element in x:
f.remove(element)
print f
desired output
[11, 22, 33, 44]
actual output
[11, 22, 33, 44, 4]
Get only unique elements from two lists python
same ask here solution:
x = [1,2,3,4]
f = [1,11,22,33,44,3,4]
res = list(set(x+f))
print(res)
[1, 2, 3, 4, 33, 11, 44, 22]
as you can see its adding 1,2,3,4 not output I need