0

Combined two list without duplicate

18th Feb 2020, 3:25 PM
MD Thoùfèék Thoufi
MD Thoùfèék Thoufi - avatar
6 ответов
+ 2
What exactly are you asking? Please explain.
18th Feb 2020, 3:27 PM
Utkarsh Sharma
Utkarsh Sharma - avatar
+ 2
list(set(list1 + list2))
18th Feb 2020, 3:33 PM
Oma Falk
Oma Falk - avatar
+ 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.
18th Feb 2020, 3:42 PM
Utkarsh Sharma
Utkarsh Sharma - avatar
0
Please add problem description
18th Feb 2020, 3:37 PM
Sumanth Hegde
Sumanth Hegde - avatar
0
Nice thank u so much
19th Feb 2020, 1:37 PM
MD Thoùfèék Thoufi
MD Thoùfèék Thoufi - avatar
- 1
Is it your homework?
18th Feb 2020, 3:34 PM
Oma Falk
Oma Falk - avatar