do intersection between list python

Solutions on MaxInterview for do intersection between list python by the best coders in the world

showing results for - "do intersection between list python"
Delfina
07 Oct 2020
1# Python program to illustrate the intersection
2# of two lists in most simple way
3def intersection(lst1, lst2):
4    lst3 = [value for value in lst1 if value in lst2]
5    return lst3
6  
7# Driver Code
8lst1 = [4, 9, 1, 17, 11, 26, 28, 54, 69]
9lst2 = [9, 9, 74, 21, 45, 11, 63, 28, 26]
10print(intersection(lst1, lst2))
11