Solution 1

``````def common_values(list_1, list_2):
if isinstance(list_1, list) and isinstance(list_2, list):
return set(list_1).intersection(set(list_2))
return "Params not of type 'list'"``````

# Set Operations (Intersection)

Create a function that will return a set of all the common elements of two lists.

``````list_1 = [1, 5, 6, 4, 8]

list_2 = [1, 6, 10, 5]

all_common_elements(list_1, list2) #{1, 5, 6}
``````

The function should additionally check to see that the parameters are list objects. If they aren't, the function should return a string that says "Params not of type 'list'".

### Test Cases

test intersection without repeated values -

``````def test_intersection_without_repeated_values():
assert common_values([4, 5, 6, 7], [1, 2, 3]) == set()
``````

test invalid argument type -

``````def test_invalid_argument_type():
assert  common_values([1, 2, 3, 4], (1, 2, 3, 4)) == "Params not of type 'list'"
``````

test intersection with common values -

``````def test_intersection_with_common_values():
assert common_values([1, 5, 7, 1, 24], [1, 2, 3, 4]) == {1}
``````
def common_values(): pass