Remove duplicate letters in a word

Eliran Gonen eg at rootshell.be
Sun Jun 22 14:11:07 EDT 2003


Hello !

I'm new in this list.

Anyway, I'm trying to write some sort of encryption program (pretty
trivial and simple) that need to check for several occurences of a letter
in a specific word.

For example, in the word SECRET, E appears twice, I need to get rid of
the second instance of E.

I'm stuck here:

    for i in range(len(key)):
        for j in range(len(key)):
            if key[i] == key[j] :
                key[j] = ""

Hope you can help me,

TIA, EG





More information about the Python-list mailing list