Instruções
Passo 8
O método
translate() recebe como argumento a tabela de tradução gerada por str.maketrans(). É chamado em uma string e retorna uma cópia da string original onde os caracteres foram substituídos com base na tabela de tradução:
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.
Chame o método translate() em text passando a translation_table como argumento e atribua o resultado a uma variável chamada encrypted_text.
O que fazer:
Testes:
- Você deve ter uma variável chamada `encrypted_text`.
- Você deve atribuir `text.translate(translation_table)` a `encrypted_text`.
Preview