Tell us what’s happening:
the code is correct and also is displayed on the console but its not passing
Your code so far
# User Editable Region
def caesar(text, shift):
if True:
return 'Shift must be an integer value'
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)
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Challenge Information:
Build a Caesar Cipher - Step 16
1 Like
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 are missing the ’ . ’ you have to print everything within the quotations
For future reference. Anything in the off colored box when they request you to return or print a specific piece of data they are expecting everything contained within. This hung me up several times at the beginning but if you pay attention to it you will eventually no longer make this small mistake. It’s a good lesson for how particular programming langues and proper syntax can be though. I found myself getting angry with it at first however I quickly learned that everything down to indentation and proper spacing has to be perfect else the python interpreter will throw and error. Key takeaway here is pay close attention to every instruction and follow it exactly down the the spaces, indentation, and punctuation. Happy coding! We’re glad to have you here!