[Python Edinburgh] Comparing two Tuples
dougal85 at gmail.com
Wed Oct 20 16:03:58 CEST 2010
Random question for you all. I've got a solution but I don't think its that
intuitive, so I'm curious if there is a neater way.
What is the best to compare two tuples and see if they contain one or more
of the same items.
A = (1,2,3)
B = (3,4,5)
C = (6,7,8)
Where A would match B because they both have 3 and C wouldn't match either.
if <magic here>:
print "One or more item is the same"
print "The tuples don't contain any of the same items"
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Edinburgh