# Learn String Manipulation by Building a Cipher - Step 49

**URL:** <https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-49/740780>\
**Category:** Curriculum Help\
**Tags:** python\
**Created:** [March 25, 2025, 8:41am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-49/740780 "2025-03-25T08:41:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![myfreecode1](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@myfreecode1](https://forum.freecodecamp.org/u/myfreecode1)\
**Post date:** [March 25, 2025, 8:41am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-49/740780/1 "2025-03-25T08:41:55Z")

</div>

### Tell us what’s happening:

According to a similar code review on the forum, my code is ok but I don’t understand why the system says “your code does not pass”

### Your code so far

```py

# User Editable Region

text = 'Hello Zaira'
shift = 3 

def caesar(): 
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    encrypted_text = ''
        
    for char in text.lower():
        
        if char == '':
            encrypted_text += char
        else:
            index = alphabet.find(char)
            new_index = (index + shift) % len(alphabet)
            encrypted_text += alphabet[new_index]
        
    print('plain text:', text)
    print('encrypted:' , encrypted_text)

# User Editable Region

```

### Your browser information:

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36`

### Challenge Information:

Learn String Manipulation by Building a Cipher - Step 49

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/step-49)**
>
> Learn to Code — For Free

 ![function code_Error](https://global.discourse-cdn.com/freecodecamp/original/4X/b/a/3/ba39a7b9f953e176d33d6538ae778d7c46264a9f.jpeg)

---

<div class="post-metadata">

**Author:** ![myfreecode1](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@myfreecode1](https://forum.freecodecamp.org/u/myfreecode1)\
**Post date:** [March 25, 2025, 10:07am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-49/740780/5 "2025-03-25T10:07:29Z")

</div>

I applied the changes. but there still an issue as you can see below this new screenshot.

 ![New_result](https://global.discourse-cdn.com/freecodecamp/original/4X/d/4/5/d4505de422ca452b63b6176805a45f0a2ddd2f60.jpeg)

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [March 25, 2025, 10:12am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-49/740780/7 "2025-03-25T10:12:38Z")

</div>

that code has more changes than just creating the function, your own code was more near than that

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [March 25, 2025, 10:13am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-49/740780/8 "2025-03-25T10:13:29Z")

</div>

> [@myfreecode1](#):
>
> ` if char == '':`

you have changed some things

your best bet is to reset the step and try again, do not change other things

---

<div class="post-metadata">

**Author:** ![myfreecode1](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@myfreecode1](https://forum.freecodecamp.org/u/myfreecode1)\
**Post date:** [March 25, 2025, 10:15am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-49/740780/9 "2025-03-25T10:15:04Z")

</div>

Ok, noted. I’m gonna try again…

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [September 23, 2025, 10:15pm UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-49/740780/10 "2025-09-23T22:15:19Z")

</div>

Closed on September 23, 2025, 10:15pm UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
