Learn String Manipulation by Building a Cipher - Step 16

Tell us what’s happening:

Describe your issue in detail here.

Your code so far


/* User Editable Region */

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



/* 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 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.

Hello Apeer,

You don’t have to change anything in your index variable. You can leave that alone.

But you don’t seem to have assigned anything to your shifted variable. How would you assign it the alphabet letter at index plus shift?

1 Like

I appreciate your feedback but I’m still unable to solve it.
image

No worries, We’re kinda going the wrong way around atm. Remember the index variable is a number (7) and so is shift (3). So if you were to so index + shift we essentially get 10.

So instead of trying to get the letter h out of index we want to get index + shift out of alphabet, since we’re trying to find the letter at place 10.

can you be more precise I’m still stuck

Sure,

So like I mentioned index + shift would be 10. If we wanted to get the letter at place 10 from alphabet we would do something like alphabet[10] and this would return us k. Instead of just writing 10 inside the brackets though, you will want to use the variables that the question wants you to use.

1 Like

Thank you so much that really helped me out…

1 Like

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