Perform a Difference on Two Sets of Data
In this exercise we are going to perform a difference on 2 sets of data. We will
create a method on our Set
data structure called difference
. A difference of
sets should compare two sets and return the items present in the first set that
are absent in the second. This method should take another Set
as an argument
and return the difference
of the two sets.
For example, if setA = ['a','b','c']
and setB = ['a','b','d','e']
, then the
difference of setA and setB is: setA.difference(setB) = ['c']
.
Test
{{test}}Console output