# Learn String Manipulation by Building a Cipher - Step 35

**URL:** <https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-35/665342>\
**Category:** Curriculum Help\
**Tags:** python\
**Created:** [January 19, 2024, 2:41am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-35/665342 "2024-01-19T02:41:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tarkovsky](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/tarkovsky/32/325768_2.png) [@tarkovsky](https://forum.freecodecamp.org/u/tarkovsky)\
**Post date:** [January 19, 2024, 2:41am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-35/665342/1 "2024-01-19T02:41:41Z")

</div>

### I am unable to cross this step, How to add the value of the same variable and assign it to the same variable?

### Your code so far

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

# User Editable Region

for char in text.lower():
    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 35

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

---

<div class="post-metadata">

**Author:** ![aaronvincent6411](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/aaronvincent6411/32/347616_2.png) [@aaronvincent6411](https://forum.freecodecamp.org/u/aaronvincent6411)\
**Post date:** [January 19, 2024, 6:39am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-35/665342/2 "2024-01-19T06:39:04Z")

</div>

> [@tarkovsky](#):
>
> encrypted\_text = alphabet[new\_index] +‘’

> `variable1 = variable1 + variable2`

u r partially correct but follow above syntax

---

<div class="post-metadata">

**Author:** ![tytywentoutformilk](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/tytywentoutformilk/32/347251_2.png) [@tytywentoutformilk](https://forum.freecodecamp.org/u/tytywentoutformilk)\
**Post date:** [January 19, 2024, 7:45am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-35/665342/3 "2024-01-19T07:45:25Z")

</div>

> [@tarkovsky](#):
>
> encrypted\_text = alphabet[new\_index] +‘’

This is the line of code that you should fix. First erase " and the main question was: **Instead of assigning `alphabet[new_index]` to `encrypted_text` , assign the current value of `encrypted_text` plus `alphabet[new_index]` to this variable.** So when you added + after alphabet{new\_index}, like this: ‘alphabet[new\_index] +’ you are on right track. **Then, just do what the question asked. Simply after add encrypted\_text variable with alphabet[new\_index} to the current value which is encrypted\_text.**

List item

---

<div class="post-metadata">

**Author:** ![tarkovsky](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/tarkovsky/32/325768_2.png) [@tarkovsky](https://forum.freecodecamp.org/u/tarkovsky)\
**Post date:** [January 19, 2024, 3:11pm UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-35/665342/4 "2024-01-19T15:11:54Z")

</div>

thank you, I got this.

---

<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:** [July 20, 2024, 3:12am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-35/665342/5 "2024-07-20T03:12:42Z")

</div>

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