# Learn String Manipulation by Building a Cipher - Step 39

**URL:** <https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-39/660052>\
**Category:** Curriculum Help\
**Tags:** python\
**Created:** [December 31, 2023, 8:18pm UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-39/660052 "2023-12-31T20:18:59Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![bthomas12422](https://avatars.discourse-cdn.com/v4/letter/b/58956e/32.png) [@bthomas12422](https://forum.freecodecamp.org/u/bthomas12422)\
**Post date:** [December 31, 2023, 8:19pm UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-39/660052/1 "2023-12-31T20:19:00Z")

</div>

### Tell us what’s happening: lesson is asking the following: Now, instead of printing `space!` , use the addition assignment operator to add the space to the current value of `encrypted_text` .

i have added the  
encrypted\_text += " "  
but am not sure why its throwing anerror  
Describe your issue in detail here.

### 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 += ' '
    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:

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

### Challenge Information:

Learn String Manipulation by Building a Cipher - Step 39

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

---

_[View the full topic](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-39/660052)._
