[Solved] Is there a way in python to compare strings for unique character [closed]


Assuming Benoît Latinier’s interpretation of your question is right (which, it looks like it is), then there will be some cases where a unique letter can’t be found, and in these cases you might throw an exception:

def unique_chars(words):
    taken = set()
    uniques = []

    for word in words:
        for char in word:
            if char not in taken:
                taken.add(char)
                uniques.append(char)
                break
        else:
            raise ValueError("There are no unique letters left!")

    return uniques

solved Is there a way in python to compare strings for unique character [closed]