arr1 = [1,2,3,4,5] arr2 = [1,2,3,4,5,6,7] arr3 = [1,2] arr1AndArr2 = list(filter(lambda a: a in arr1, arr2)) res = list(filter(lambda a : a in arr1AndArr2, arr3)) print(res)