To get a set of elements that are present in data1
, but not in data2
, we use the difference()
instruction.
Using difference()
gives us the elements that the left set, here data1
has, but the right set, here data2
, doesn't.
>>> data1 = {1,2,3}
>>> data2 = {3,4,5}
>>> data1.difference(data2)
{1, 2}