curriculum/challenges/english/blocks/workshop-caesar-cipher/6819bc0637b80256a33adccc.md
Now that you've implemented the basic functionalities of the cipher, it's time to add some validation. For that, you'll need an if statement. Here's a reminder of the syntax for an if statement:
if condition:
# code to run when condition is true
At the beginning of your function body, create an if statement. For now, use True as the condition, and within the if statement body return the string Shift must be an integer value.
You should have an if statement inside your caesar function.
({ test: () => assert(runPython(`_Node(_code).find_function("caesar").find_ifs()[0]`)) })
Your if statement should use True as its condition.
({ test: () => assert(runPython(`_Node(_code).find_function("caesar").find_ifs()[0].find_conditions()[0].is_equivalent("True")`)) })
You should return the string Shift must be an integer value. from your if statement.
({ test: () => assert(runPython(`_Node(_code).find_function("caesar").find_ifs()[0].find_bodies()[0].has_return("'Shift must be an integer value.'")`)) })
def caesar(text, shift):
--fcc-editable-region--
--fcc-editable-region--
alphabet = 'abcdefghijklmnopqrstuvwxyz'
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
translation_table = str.maketrans(alphabet + alphabet.upper(), shifted_alphabet + shifted_alphabet.upper())
return text.translate(translation_table)
encrypted_text = caesar('freeCodeCamp', 3)
print(encrypted_text)