- 1
"Secret message" problem.
My code: https://code.sololearn.com/cuOYOs3Bn1gX/?ref=app It is, surprisingly, not obeying my "reverse_alphabet" dictionary. What is the problem with it?
2 Antworten
+ 6
You are performing replace for every letter, but everytime for the full word.
This means, that you might switch letters back and forth a few times.
I'd choose this method:
w = ''
for letter in new_message:
w += reverse_alphabet[letter]
print(w)
+ 1
HonFu, you are absolutely right! I am really grateful for your teaching ("don't be afraid to build a string form scratch")!