Common items

Write common_items(a, b) that returns the values that appear in both lists, each once, in the order they first appear in a.

common_items([3, 1, 4, 1, 5], [5, 1, 9])  ->  [1, 5]
common_items([1, 2], [3])                 ->  []

The point is to practise using a set for membership. One check uses two lists of a hundred thousand items each; x in b on a list inside a loop over a is ten billion steps and will not finish in time.

def common_items(a, b):
    ...