How to find list intersection?

a = [1,2,3,4,5]
b = [1,3,5,6]
c = a and b
print c

actual output: [1,3,5,6]
expected output: [1,3,5]

How can we achieve a boolean AND operation (list intersection) on two lists?

16 Answers
16

Leave a Comment