a = [1,2,3,4,5,6,8]
b = [6,8,9,4,5,3,2,1]
final result should be
c = [6,8,4,5]
This array contains the same pair of numbers in both arrays - how to write this kind of code in python?
I only known how to create an array with duplicated values
a = [1,2,3,4,5,6,8]
b = [6,8,9,4,5,3,2,1]
c = [x for x in a if x in b]
print (c)