Given two sets
a = [5,3,4,1,2,6,7]
b = [1,2,4,9]
c = set(a) - set(b)
# c -> [5,3,6,7]
is it possible to count how many items were removed from set 'a' ?
Given two sets
a = [5,3,4,1,2,6,7]
b = [1,2,4,9]
c = set(a) - set(b)
# c -> [5,3,6,7]
is it possible to count how many items were removed from set 'a' ?
How about len(set(a)) - len(c)?
Edit: len(a) could be incorrect if a contains duplicates.
Assuming lack of duplicates:
len(a)-len(c)
otherwise try:
len(set(a)) - len(c)
there might be a more efficient way, but
len(set(a)-set(c))
will work