Answers for "python two lists intersection"

8

intersection of two lists python

>>> a = [1,2,3,4,5]
>>> b = [1,3,5,6]
>>> list(set(a) & set(b))
[1, 3, 5]
Posted by: Guest on August-10-2020
1

intersection of lists in python

import numpy as np
recent_coding_books =  np.intersect1d(recent_books,coding_books)
Posted by: Guest on June-08-2020
0

python get the intersection of two lists

# intersection of two lists (lst1 & lst2)
In [1]: x = ["a", "b", "c", "d", "e"]

In [2]: y = ["f", "g", "h", "c", "d"]

In [3]: set(x).intersection(y)
Out[3]: {'c', 'd'}
# has_intersection = bool(set(x).intersection(y)) -> True
Posted by: Guest on September-28-2021

Code answers related to "python two lists intersection"

Python Answers by Framework

Browse Popular Code Answers by Language