W
W
WolfInChains2020-06-19 17:21:37
Python
WolfInChains, 2020-06-19 17:21:37

How to completely remove duplicate elements in 2 lists?

There are 2 lists, you need to create 3, which will contain elements that are not repeated in 1 and 2.
Example:

list_1 = ['1', '2', '3']
list_2 = ['1', '3', '4']
list_3 = ['2', '4']

Question - how to completely remove duplicate elements?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-06-19
@WolfInChains

list_3 = set(list_1) ^ set(list_2)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question