curriculum/challenges/english/blocks/workshop-caesar-cipher/6818b80519e6c6c47a8bb6e8.md
As you learned in a previous lesson, functions can have parameters, which are variables that can be referenced within the function. Here's a sum function with two parameters, num1 and num2.
def sum(num1, num2):
print(num1 + num2)
The message to encrypt and the shift are still hardcoded in your function. Give your function two parameters named text and shift, and delete the declarations of both the text and shift variables from the caesar function body.
Your caesar function should have two parameters, text and shift.
({ test: () => assert(runPython(`_Node(_code).find_function("caesar").has_args("text, shift")`)) })
You should not have a text variable declared within the caesar function body.
({ test: () => assert(runPython(`not _Node(_code).find_function("caesar").find_body().has_variable("text")`)) })
You should not have a shift variable declared within the caesar function body.
({ test: () => assert(runPython(`not _Node(_code).find_function("caesar").find_body().has_variable("shift")`)) })
--fcc-editable-region--
def caesar():
alphabet = 'abcdefghijklmnopqrstuvwxyz'
shift = 5
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
translation_table = str.maketrans(alphabet, shifted_alphabet)
text = 'hello world'
--fcc-editable-region--
encrypted_text = text.translate(translation_table)
print(encrypted_text)