input: Write a function to compare two lists and return a list of common elements.
  assert compare_list([1, 2, 3, 4, 5], [2, 3, 8, 9, 10]) == [2, 3]
  assert compare_list([10, 20, 30], [20, 30, 40]) == [20, 30]
  assert compare_list([5, 6, 7], [1, 2, 3]) == []
output: def compare_list(list1, list2):
      return [element for element in list1 if element in list2]