Build a Caesar Cipher - Step 16

Tell us what’s happening:

Hello,

I’m stuck here since yesterday and I really don’t understand what I am missing.

I put return not print, the spelling is correct I checked, I even tried to add the else to see if it was the missing part. The two other posts about this exercise didn’t help me to see where my mistake might be.

Thanks

Your code so far


# User Editable Region

def caesar(text, shift):
    if True:
        return "Shift must be a integer value.";

# User 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)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0

Challenge Information:

Build a Caesar Cipher - Step 16

Hi @Loup and welcome to our community!

Your code does not exactly match the required string value:

return the string Shift must be an integer value..

Also, you don’t need semicolons in Python, to terminate statements (although that is not causing your code to fail).

Hi, You’re right my bad! I need to be extra more careful. Thank you :folded_hands:

1 Like

(post deleted by author)