Build a Caesar Cipher - Step 22

Tell us what’s happening:

I am stuck in step 22 of the Python certification. I have done everything right as far as I know, but the tests are failing, saying the shift variable should be set to “shift = - shift”. I did that too, but nothing is working out

Your code so far

def caesar(text, shift, encrypt=True):
    if not encrypt:
        shift = - shift

    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'
    
# User Editable Region
    
# User Editable Region
    
    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

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/153.0.0.0 Safari/537.36

Challenge Information:

Build a Caesar Cipher - Step 22

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-caesar-cipher/681a1d60e037127e7c8e0230.md at main · freeCodeCamp/freeCodeCamp · GitHub

consider, it’s 13, here it becomes -13

what happens here:

note where the highlighted part of the code to add the new if is