get overlap between two lists python

Solutions on MaxInterview for get overlap between two lists python by the best coders in the world

showing results for - "get overlap between two lists python"
Amir
06 Aug 2020
1# Python program to illustrate the intersection
2# of two lists using set() method
3def intersection(lst1, lst2):
4    return list(set(lst1) & set(lst2))
5  
6# Driver Code
7lst1 = [15, 9, 10, 56, 23, 78, 5, 4, 9]
8lst2 = [9, 4, 5, 36, 47, 26, 10, 45, 87]
9print(intersection(lst1, lst2))
10