curriculum/challenges/english/blocks/workshop-caesar-cipher/680a836235461fce1ff53b3f.md
The translate() method takes as argument the translation table generated by str.maketrans(). It is called on a string and returns a copy of the original string where the characters have been replaced based on the translation table:
t = str.maketrans('lk', 'br')
sentence = 'The tent gave in to the leaks.'
print(sentence.translate(t))
# Output: The tent gave in to the bears.
Call the translate() method on text passing in the translation_table as the argument and assign the result to a variable named encrypted_text.
You should have a variable named encrypted_text.
({ test: () => assert(runPython(`_Node(_code).has_variable("encrypted_text")`)) })
You should assign text.translate(translation_table) to encrypted_text.
({ test: () => assert(runPython(`_Node(_code).find_variable("encrypted_text").is_equivalent("encrypted_text = text.translate(translation_table)")`)) })
alphabet = 'abcdefghijklmnopqrstuvwxyz'
shift = 5
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
translation_table = str.maketrans(alphabet, shifted_alphabet)
text = 'hello world'
--fcc-editable-region--
--fcc-editable-region--