Test Informed Learning with Examples

Logo

Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.

Menu

LinkedIN Community

Join our LinkedIN Community.

Intersecting two sets

Write a tuple_inter function that receives two sets. The function must return a tuple that contains the intersection of the two sets and the result of erasing the intersection in the first set.

For example you can test your function with:

>>> firstSet  = {23, 42, 65, 57, 78, 83, 29}
>>> secondSet = {57, 83, 29, 67, 73, 43, 48}

>>> tuple_inter(firstSet, secondSet)
    ({57, 83, 29}, {65, 42, 78, 23})
>>> tuple_inter(firstSet, firstSet)
    ({65, 83, 23, 57, 42, 29, 78}, set())
>>> tuple_inter(set(), set())
    (set(), set())