comparing values in two sets
John Salerno
johnjsal at NOSPAMgmail.com
Sun May 14 18:59:57 EDT 2006
I'd like to compare the values in two different sets to test if any of
the positions in either set share the same value (e.g., if the third
element of each set is an 'a', then the test fails).
I have this:
def test_sets(original_set, trans_letters):
for pair in zip(original_set, trans_letters):
if pair[0] == pair[1]:
return False
return True
zip() was the first thing I thought of, but I was wondering if there's
some other way to do it, perhaps a builtin that actually does this kind
of testing.
Thanks.
More information about the Python-list
mailing list