Learn String Manipulation by Building a Cipher - Step 29

Tell us what’s happening:

someone please check my code and tell me what im doing wrong

Your code so far


# User Editable Region

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for char in text.lower():
 new_index = index + shift
index = alphabet.find(char)
print(char,new_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/127.0.0.0 Safari/537.36 Edg/127.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 29

Hi there,

The instruction said:

At the end of your loop body, declare a variable called new_index and assign the value of index + shift to this variable.

So you have to put it after the print statement.

Also, the indentation problems of the for loop we talked about in your previous question.

you are not to edit the code given to you, just add new_index = index + shift at the end of the code