Learn String Manipulation by Building a Cipher Step 29

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

CODE AS WAS:

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'

for char in text.lower():
    index = alphabet.find(char)
    print(char, index) 

**MY CODE:**
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'

for char in text.lower():
    index = alphabet.find(char)
    new_index = (index + shift)
    print(char, index)

Not working. Even with
print(char, index, new_index)
or
print(char, new_index) even though it doesnt ask for it…idk what im doing wrong. :man_shrugging:

Hi and welcome to our forum!

Kindly include a link to the lesson.

1 Like

Your line of code should come after the print statement.
Also, what are the brackets nesting your code for?