Build a Caesar Cipher - Step 17

Tell us what’s happening:

What is wrong with my code? I replaced the condition didn’t I?

Your code so far


# User Editable Region

def caesar(text, shift):
    if True:
        isinstance(shift, int)
        return 'Shift must be an 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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

Challenge Information:

Build a Caesar Cipher - Step 17

Hi @Rc2025

Are you sure you replaced the condition?

Happy coding

1 Like

THANKS A LOT!! The way you help makes me think about what I’m doing wrong and helps me rethink the whole thing.

1 Like

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge. This button only appears if you have tried to submit an answer at least three times.

The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.