Build a Caesar Cipher - Step 24

Tell us what’s happening:

I am stucked on Step 24. Please, could someone help me?

Your code so far

def caesar(text, shift, encrypt=True):

    if not isinstance(shift, int):
        return 'Shift must be an integer value.'

    if shift < 1 or shift > 25:
        return 'Shift must be an integer between 1 and 25.'

    alphabet = 'abcdefghijklmnopqrstuvwxyz'

    if not encrypt:
        shift = - shift
    
    shifted_alphabet = alphabet[shift:] + alphabet[:shift]
    translation_table = str.maketrans(alphabet + alphabet.upper(), shifted_alphabet + shifted_alphabet.upper())
    encrypted_text = text.translate(translation_table)
    return encrypted_text

def encrypt(text, shift):
    return caesar(text, shift)
    caesar('hello', 3)
    
def decrypt(text, shift):
    return caesar(text, shift, encrypt=False)

# User Editable Region



encrypted_text('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/145.0.0.0 Safari/537.36

Challenge Information:

Build a Caesar Cipher - Step 24

please keep in mind that encrypted_text is not a function, you need to create a variable encrypted_text and assign it a value

this value will be the result of calling the encrypt function

pretty similar to how it was before, if you reset the step you can recover the previous assignment to encrypted_text and see how a call to caesar was assigned to it

thank you, I could solve it :slight_smile: