Learn String Manipulation by Building a Cipher - Step 16

Tell us what’s happening:

What mistake did I make? Please explain to me.

Your code so far


/* User Editable Region */

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
index = alphabet.find(text[0].lower())
shifted = index + shift
print(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

shifted should be the character in alphabet at the index index + shift. You are currently assigning an integer number to shifted.

let us go through the steps needed to solve this challenge.

First declare a variable called “shifted”

Second assign it a value. which is going to be a letter in the “alphabet” variable. The position of this letter will be at “index + shift”, to access that position in the alphabet variable use square bracket.

If you still find it challenging at this point please reach out. Happy codding :muscle: :muscle: :muscle:

1 Like

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