curriculum/challenges/english/blocks/workshop-caesar-cipher/680a7e200400089967b8b1f4.md
The str.maketrans() method takes two strings of equal length and returns a translation table that maps each character of the first string with the corresponding character of the second string. Each character in the translation table is stored as a Unicode ordinal, a number that uniquely identifies the character.
lower_chars = 'abc'
upper_chars = 'ABC'
table = str.maketrans(lower_chars, upper_chars)
print(table) # {97: 65, 98: 66, 99: 67}
You'll learn more about the type of structure returned by str.maketrans() later on in the curriculum. For now, create a translation table that maps the characters in alphabet to the characters in shifted_alphabet and assign it to a variable named translation_table.
You should declare a variable named translation_table.
({ test: () => assert(runPython(`_Node(_code).has_variable("translation_table")`)) })
You should call str.maketrans() passing in alphabet and shifted_alphabet as the arguments, and assign the result to translation_table.
({ test: () => assert(runPython(`_Node(_code).find_variable("translation_table").is_equivalent("translation_table = str.maketrans(alphabet, shifted_alphabet)")`)) })
alphabet = 'abcdefghijklmnopqrstuvwxyz'
shift = 5
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
--fcc-editable-region--
--fcc-editable-region--