Dealing with multiple sets
Gabriel Genellina
gagsl-py at yahoo.com.ar
Wed Oct 25 20:30:45 EDT 2006
At Wednesday 25/10/2006 21:12, John Henry wrote:
>Oops. Forgot to mention, I am still using 2.3.
try: set
except NameError: from sets import Set as set
and the code will work almost exactly the same in 2.3/2.4
> > 1) Give me a list of the items that are in all of the sets? (3 in the
> > above example)
a & b & c
& is the intersection operator.
> > 2) Give me a list of the items that are not in all of the sets? (1,2 in
> > the above example)
(a | b | c) - (a & b & c)
(take the union of all items) except (the ones that are
simultaneously in all sets)
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
More information about the Python-list
mailing list