# Caesar cipher - stuck on step 25

**URL:** <https://forum.freecodecamp.org/t/caesar-cipher-stuck-on-step-25/801110>\
**Category:** Curriculum Help\
**Tags:** python\
**Created:** [September 26, 2026, 1:33am UTC](https://forum.freecodecamp.org/t/caesar-cipher-stuck-on-step-25/801110 "2026-09-26T01:33:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tcm692](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/tcm692/32/422022_2.png) [@tcm692](https://forum.freecodecamp.org/u/tcm692)\
**Post date:** [September 26, 2026, 1:33am UTC](https://forum.freecodecamp.org/t/caesar-cipher-stuck-on-step-25/801110/1 "2026-09-26T01:33:59Z")

</div>

Continuing the discussion from [Build a Caesar Cipher - Step 25](https://forum.freecodecamp.org/t/build-a-caesar-cipher-step-25/800967):

I’m having the same issue -here’s my code:

```auto
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 = 'Pbhentr vf sbhaq va hayvxryl cynprf.'
    return encrypted_text

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

encrypted_text = encrypt('freeCodeCamp', 3)
decrypted_text = decrypt(encrypted_text, 13)
print(decrypted_text)

```

Yet I get the message:  
You should assign `Pbhentr vf sbhaq va hayvxryl cynprf.` to `encrypted_text`.

I’ve done that!!! On the line above ‘return encrypted\_text’.

Any help?

---

<div class="post-metadata">

**Author:** ![Teller](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/teller/32/412338_2.png) [@Teller](https://forum.freecodecamp.org/u/Teller)\
**Post date:** [September 26, 2026, 3:16am UTC](https://forum.freecodecamp.org/t/caesar-cipher-stuck-on-step-25/801110/2 "2026-09-26T03:16:22Z")

</div>

Welcome to the forum @tcm692

Here is a comparison of the original code and your code.

The code in blue is the original code, the code in red is your code.  
The code in magenta is the overlap.

 ![image](https://global.discourse-cdn.com/freecodecamp/original/4X/3/7/e/37e7b3f56e2f7aefa25f6577b071f58d034c627c.png)

It looks like you modified the wrong `encrypted_text` variable.

Please reset the step to restore the seed code and try again.

You need to change the assignment for the `encrypted_text` variable that is visible in the editor, not the one inside the body of the `caesar` function.

Happy coding
