Fill the blank
# returns elements of a that are also in b
def common(a, b):
b_set = set(b)
return [x for x in a ____ x in b_set]
# common([1,2,3],[2,3,4]) -> [2,3]
Answer: if
The if clause filters the comprehension to matching elements.
Play Problem Solving ▸