Learn String Manipulation by Building a Cipher - Step 16

Tell us what’s happening:

I am genuinely very stuck, I have tried most things by myself and have also looked through the forum and still have no clue, any advice/ small amounts of guidance would be greatly appreciated. :slight_smile:

Your code so far

# User Editable Region

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

# 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/ Safari/537.36 OPR/

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 16

Hi, welcome to this community.

You almost got the answer. Move the “+ shift” part of the following line inside the square brackets.

shifted= alphabet[7] + shift
1 Like

Use this syntax:
variable = string[num1 + num2]

You are correct up to here:

but you need to add index + shift between the square brackets. (7 would work as well, but it’s stored in the index variable and we’ll want to reuse this code, so you need to use the variable. You want to avoid hard coding numbers like this)

How in the world did you get that from the provided instructions? They were certainly not clear to me.

Yes, it was a little hard to tell exactly what was being asked but after submitting an answer, the hints that showed up gave me a clue about what was expected from my answer.

This step is being re-worked currently, a lot of people have found it difficult to understand.

to answer your question though:

Declare a variable named shifted and assign it the alphabet letter at index plus shift.

Declare a variable named shifted
shifted =

assign it the alphabet letter at index
shifted = alphabet[index]

…plus shift.

shifted = alphabet[index + shift]

This is how it’s meant to be interpreted, if you broke it down into smaller steps.

Again, many people have had problems with this step. It’s in beta and it’s being re-worked.