How to Find Which Elements Appear in Two Different Lists
Python
By converting our lists to sets we can use the intersection function to determine which elements appear in both the x and y lists.
1| x = [1,2,3,4] 2| y = [3,4,5,6] 3| 4| z = set(x).intersection(y) 5| 6| print(z) 7| 8| >> {3, 4}
131
118
115
108