Learn String Manipulation by Building a Cipher - Step 29

Tell us what’s happening:

This is the code I wrote:

text = ‘Hello World’
shift = 3
alphabet = ‘abcdefghijklmnopqrstuvwxyz’

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

Where am I missing out ?

Your code so far


# User Editable Region

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

for char in text.lower():
    index = alphabet.find(char)  
    new_index = index + shift 
    print(char, 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/134.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 29

Welcome to the forum :wave:

Do you get an error message or any hints?

// running tests
2. You should assign index + shift to your new variable at the end of your for loop body.
// tests completed

Did you see the instruction “at the end” ?

Step 29
At the end of your loop body,