Learn String Manipulation by Building a Cipher - Step 16

Tell us what’s happening:

Describe your issue in detail here.
##KingMrMonopoly: Hello I’m having a problem with this line of code anything that you suggest I do different?

``````
/* User Editable Region */

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

/* User Editable Region */

``````

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

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 16

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Use the format `variable = string[var1 + var2]`

You are correct up to this point:

``````shifted = alphabet
``````

Do you remember how to access a letter position of a string? `text[0]` accesses the letter at the first (0) position of `text`.

You want to access a letter in the string `alphabet` at the position `index + shift`

Try these steps:

• declare a variable named `shifted` and assign it the string `alphabet`
• modify the assignment into `alphabet` at position `index` using square brackets
• modify the position in the square brackets to `index + shift`

You know if you want to access the `h` in `alphabet` would be `alphabet[7]` since you already found the position. Now you want to slide 3 (stored in the `shift` variable) letters down the alphabet from `h` and get that letter.

Here’s a list of solved topics on this step:
https://forum.freecodecamp.org/search?expanded=true&q=Cipher%20-%20Step%2016%20%23python%20in%3Atitle%20status%3Asolved