0
Combined two list without duplicate
6 Respostas
+ 2
What exactly are you asking? Please explain.
+ 2
list(set(list1 + list2))
+ 2
I will explain Oma Falk 's answer.
Let list1 = [1,2,4]
And list2 = [2,4,6,8]
What set function does is that it creates a set but a set only contain unique entries, so all the duplicate entries are removed.
So this set will look like this
{1,2,4,6,8}
But it is no more a list, so to convert it back to list we use list()
list({1,2,4,6,8})
[1,2,4,6,8]
So we can say that
list(set(list1+list2)) == [1,2,4,6,8]
If this is not what you want to know then explain your question.
0
Please add problem description
0
Nice thank u so much
- 1
Is it your homework?