Dear Pythoners,
I am trying to extract from a set of about 20 sequences, the characters which are unique to each sequence. For simplicity, imagine I have only 3 "sequences" (words in this example) such as: s1='spam'; s2='scam', s3='slam' I would like the character that is unique to each sequence, i.e. I need my function to return the list [ 'p', 'c', ',l' ]. This function I am using is as follows: def uniq(*args): """ FIND UNIQUE ELEMENTS OF AN ARBITRARY NUMBER OF SEQUENCES""" unique = [] for i in args[0]: if i not in args[1:]: unique.append(i) return unique and is returning the list [ 's', 'p', 'a', 'm' ]. Any help much appreciated, Best, Spyros
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor