I am trying to make a code breaking game where the user submits symbol/letter pairs to a dictionary to crack a code, I then want the code to use the dictionary to replace each instance of a symbol with the paired letter.
I have the following bits of code:
words = imported list of coded words where each letter is replaced by a symbol. from a text file so i can change later
clues = dictionary of symbol and letter pairs that can be added to, removed from
I have tried the following but it failed with: TypeError: list indices must be integers, not str
def converter(words,clues):
progression = words
for words in progression:#cycles through each coded word in the list
for key in clues: #for each symbol in the dictionary
progression[words] = progression[words].replace(key, clues[key]) #replaces
return progression
Any help that anyone could offer I would be very grateful.
Adam