solutions

Set Operations (Union)

Create a function that will return a set of all elements in at least one of the tuples.

tuple_1 = (1, 5, 6, 4, 8)
tuple_2 = (1, 6, 10, 5)

common_values(tuple_1, tuple_2)  #{1, 4, 5, 6, 8, 10}

Test Cases

test without repeated values - Run Test

def test_without_repeated_values():
    assert common_values((4, 5, 6, 7), (1, 2, 3)) == {1, 2, 3, 4, 5, 6, 7}

test with repeated values - Run Test

def test_with_repeated_values():
    assert common_values((1, 5, 7, 1, 24), (1, 2, 3, 4)) == {1, 2, 3, 4, 5, 7, 24}