Logo

Programming-Idioms

History of Idiom 218 > diff from v14 to v15

Edit summary for version 15 by programming-idioms.org:
Restored version 13

Version 14

2020-05-02, 19:23:14

Version 15

2020-05-02, 19:48:57

Idiom #218 List intersection

Create list c containing all unique elements that are contained in both lists a and b.
c should not contain any duplicates, even if a and b do.
The order of c doesn't matter.

Idiom #218 List intersection

Create list c containing all unique elements that are contained in both lists a and b.
c should not contain any duplicates, even if a and b do.
The order of c doesn't matter.

Extra Keywords
intersect and conjunction
Extra Keywords
intersect and conjunction
Code
c = list(set(a).intersection(b))
Code
c = list(set(a) & set(b))