# Learn String Manipulation by Building a Cipher - Step 44

**URL:** <https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-44/687640>\
**Category:** General\
**Tags:** español\
**Created:** [April 29, 2024, 3:08am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-44/687640 "2024-04-29T03:08:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nofiction00](https://avatars.discourse-cdn.com/v4/letter/n/e9bcb4/32.png) [@nofiction00](https://forum.freecodecamp.org/u/nofiction00)\
**Post date:** [April 29, 2024, 3:08am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-44/687640/1 "2024-04-29T03:08:22Z")

</div>

### Tell us what’s happening:

I´ve tried to indent the code in many different ways and it´s still showing error. I don´t undestand what is the precise portion that is wrong neither could find it on the forum. Please help.

### Your code so far

```py

# User Editable Region

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''

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

# User Editable Region

```

### Your browser information:

El agente de usuario es: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0`

### Challenge Information:

Learn String Manipulation by Building a Cipher - Step 44

> **[freeCodeCamp.org](https://www.freecodecamp.org/espanol/learn/scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/step-44)**
>
> Aprende a programar, ¡GRATIS!

---

<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:** [April 29, 2024, 3:13am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-44/687640/2 "2024-04-29T03:13:01Z")

</div>

Welcome to the forum @nofiction00

> [@](#):
>
> ```auto
> if x != 0:
> print(x)
> else:
> print('x = 0')
> 
> ```

> To fix it, add an `else` clause after `encrypted_text += char` and indent all the subsequent lines of code except the `print()` call.

The instructions ask you to indent the three lines of code between the **else** statement and the **print** call.

> [@nofiction00](#):
>
> ```auto
> encrypted_text += char
> else
> index = alphabet.find(char)
> new_index = index + shift
> encrypted_text += alphabet[new_index]
> print('char:', char, 'encrypted text:', encrypted_text)
> 
> ```

Also, check the example. Your **else** statement is missing something.

Happy coding

---

<div class="post-metadata">

**Author:** ![nofiction00](https://avatars.discourse-cdn.com/v4/letter/n/e9bcb4/32.png) [@nofiction00](https://forum.freecodecamp.org/u/nofiction00)\
**Post date:** [April 29, 2024, 3:26am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-44/687640/3 "2024-04-29T03:26:26Z")

</div>

thanks, I could fix it.

---

<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:** [January 7, 2025, 2:15pm UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-44/687640/4 "2025-01-07T14:15:59Z")

</div>

Closed on January 7, 2025, 2:15pm UTC


