Advertisement
Guest User

intersection

a guest
Aug 19th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. # Python program to illustrate the intersection
  2. # of two lists in most simple way
  3. def intersection(lst1, lst2):
  4.     lst3 = [value for value in lst1 if value in lst2]
  5.     return lst3
  6.  
  7. # Driver Code
  8. lst1 = [4, 9, 1, 17, 11, 26, 28, 54, 69]
  9. lst2 = [9, 9, 74, 21, 45, 11, 63, 28, 26]
  10. print(intersection(lst1, lst2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement