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
iterables".
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.

Thanks

#Code below
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]
a.difference(not_a)

# I expect to return set([1]), the same as if I called:
a.difference(b,c,d)
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to