[Tutor] Using the set.difference method with an unknown number of input iterables
ryan.waples at gmail.com
Thu Oct 18 19:38:57 CEST 2012
I'm struggling to understand how to understand/accomplish the following:
I have an set ("a" below) and a list of sets ("not_a"), how can I pass the
elements of "not_a" to set.difference() so that it it understands I want
the difference between set "a" and all the rest
set.difference says "Changed in version 2.6: Accepts multiple input
How can I give it multiple input iterables?
I get different error msgs depending on what I try, but they just tell me
that there is something that I'm missing here.
a = set([1,2,3,4])
b = set([2,3,4,5])
c = set([3,4,5,6])
d = set([4,5,6,7])
not_a = [b,c,d]
# I expect to return set(), the same as if I called:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor