Learn String Manipulation by Building a Cipher - Step 16

I need help, this one is blowing my mind, already tried several way but still stuck

MY code so far


/* User Editable Region */

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

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

Here you need to access the value of alphabet at the index index + shift. To access the value of a variable at a specific index you need to write the variable name and and specify the index inside square brackets.

1 Like

The question is: Declare a variable named shifted and assign it the alphabet letter at index plus shift

SOLUTION

# first declare a variable call “shifted” just like you have done

# use the assignment operator “=” to assign it a value.

# now you need to figure out the value. the letter we are looking for is in the position of “index + shift” in the alphabet variable.

# access that position with the use of square bracket “[ ]” remember it is in the alphabet variable that you will be looking for this letter.

Please if you find it difficult finding the solution from here kindly reach out, as we will be ready to be of assistance.

1 Like

i have the same problem

i worte :

shifted = index + shift ( wrong)
shifted = ‘k’ (wrong)

:frowning:

You are very close to being right here all you need to do is apply

# access that position with the use of square bracket “[ ]” remember it is in the alphabet variable that you will be looking for this letter.

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

im sorry sampsoninyang im new with this i have no experience in this thats why i still not geting it :frowning:

I got you, try

Mod Edit SOLUTION REMOVED

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

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