# Learn String Manipulation by Building a Cipher - Step 16

**URL:** <https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925>\
**Category:** Curriculum Help\
**Tags:** python\
**Created:** [January 10, 2024, 1:23am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925 "2024-01-10T01:23:09Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![crownmarc8](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/crownmarc8/32/320874_2.png) [@crownmarc8](https://forum.freecodecamp.org/u/crownmarc8)\
**Post date:** [January 10, 2024, 1:23am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/1 "2024-01-10T01:23:09Z")

</div>

### Tell us what’s happening:

so i have typed this in a few different this was my final before i decided to ask for help

### Your code so far

```py

/* User Editable Region */

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
index = alphabet.find(text[0].lower())
print(index)
shifted = 7 + 3

/* 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 Edg/120.0.0.0`

### Challenge Information:

Learn String Manipulation by Building a Cipher - Step 16

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

---

<div class="post-metadata">

**Author:** ![pkdvalis](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pkdvalis/32/350571_2.png) [@pkdvalis](https://forum.freecodecamp.org/u/pkdvalis)\
**Post date:** [January 10, 2024, 3:17am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/3 "2024-01-10T03:17:59Z")

</div>

Use this format:

```auto
variable = string[var1 + var2]

```

Find the character in the string `alphabet` at the position `index + shift` and assign it to the variable `shifted`

---

<div class="post-metadata">

**Author:** ![crownmarc8](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/crownmarc8/32/320874_2.png) [@crownmarc8](https://forum.freecodecamp.org/u/crownmarc8)\
**Post date:** [January 11, 2024, 2:48am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/4 "2024-01-11T02:48:50Z")

</div>

I tryed using that format but still no results I am lost

---

<div class="post-metadata">

**Author:** ![pkdvalis](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pkdvalis/32/350571_2.png) [@pkdvalis](https://forum.freecodecamp.org/u/pkdvalis)\
**Post date:** [January 11, 2024, 3:31am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/5 "2024-01-11T03:31:50Z")

</div>

Let’s see it, can you please share your code?

---

<div class="post-metadata">

**Author:** ![crownmarc8](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/crownmarc8/32/320874_2.png) [@crownmarc8](https://forum.freecodecamp.org/u/crownmarc8)\
**Post date:** [January 11, 2024, 9:36pm UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/6 "2024-01-11T21:36:54Z")

</div>

sure will do

```auto

text = 'Hello World'

shift = 3

alphabet = 'abcdefghijklmnopqrstuvwxyz'

index = alphabet.find(text[0].lower())

print(index)

shifted = "h" [index + shitf]

```

---

<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 11, 2024, 9:38pm UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/7 "2024-01-11T21:38:19Z")

</div>

you need to access the `alphabet` string

---

<div class="post-metadata">

**Author:** ![crownmarc8](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/crownmarc8/32/320874_2.png) [@crownmarc8](https://forum.freecodecamp.org/u/crownmarc8)\
**Post date:** [January 11, 2024, 9:52pm UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/8 "2024-01-11T21:52:11Z")

</div>

how would i code that im guessing it would be formatted like this shifted = [alphabet + index]

---

<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 11, 2024, 9:53pm UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/9 "2024-01-11T21:53:10Z")

</div>

no, you start with `alphabet`, then you use the brackets with a number inside to say which character inside `alphabet` you want

---

<div class="post-metadata">

**Author:** ![pkdvalis](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pkdvalis/32/350571_2.png) [@pkdvalis](https://forum.freecodecamp.org/u/pkdvalis)\
**Post date:** [January 11, 2024, 10:45pm UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/10 "2024-01-11T22:45:09Z")

</div>

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.

 ![Pre-formatted-text](https://global.discourse-cdn.com/freecodecamp/original/3X/1/b/1b18854f1059217f29370444396145cc3a0cd8ae.gif)

See [this post](https://forum.freecodecamp.org/t/forum-code-formatting/25574) to find the backtick on your keyboard.  
**Note:** Backticks (`) are not single quotes (').

---

<div class="post-metadata">

**Author:** ![pkdvalis](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pkdvalis/32/350571_2.png) [@pkdvalis](https://forum.freecodecamp.org/u/pkdvalis)\
**Post date:** [January 11, 2024, 10:46pm UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/11 "2024-01-11T22:46:21Z")

</div>

you can use a syntax like this:

```auto
variable = string[var1 + var2]

```

---

<div class="post-metadata">

**Author:** ![crownmarc8](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/crownmarc8/32/320874_2.png) [@crownmarc8](https://forum.freecodecamp.org/u/crownmarc8)\
**Post date:** [January 13, 2024, 3:15am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/12 "2024-01-13T03:15:59Z")

</div>

so alphabet[7+shift} I have typed this code in so many different ways

---

<div class="post-metadata">

**Author:** ![crownmarc8](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/crownmarc8/32/320874_2.png) [@crownmarc8](https://forum.freecodecamp.org/u/crownmarc8)\
**Post date:** [January 13, 2024, 3:16am UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/13 "2024-01-13T03:16:37Z")

</div>

okay I am going to try it out

---

<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 13, 2024, 3:17pm UTC](https://forum.freecodecamp.org/t/learn-string-manipulation-by-building-a-cipher-step-16/662925/14 "2024-07-13T15:17:22Z")

</div>

Closed on July 13, 2024, 3:17pm UTC

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