Comparing lists

Odd-R. oddr at home.no.no
Mon Oct 10 03:32:53 EDT 2005


I have to lists, A and B, that may, or may not be equal. If they are not 
identical, I want the output to be three new lists, X,Y and Z where X has 
all the elements that are in A, but not in B, and Y contains all the 
elements that are B but not in A. Z will then have the elements that are 
in both A and B.

One way of doing this is of course to iterate throug the lists and compare 
each of the element, but is there a more efficient way?

Thanks in advance!



-- 
Har du et kjøleskap, har du en TV
så har du alt du trenger for å leve

-Jokke & Valentinerne



More information about the Python-list mailing list