Learn String Manipulation by Building a Cipher - Step 33

Tell us what’s happening:

It is telling me to create a new_char but I already have, where did I get it wrong

Your code so far


# User Editable Region

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

for char in text.lower():
    index = alphabet.find(char)
    print(char, index)
    new_index = index + shift
new_char = alphabet[new_index]
print('char:', char, 'new char:', new_char)

# 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/136.0.0.0 Safari/537.36 Edg/136.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 33

1 Like

is that at the end of your loop body?

You’re very close! Think about the for loop, is that really how it should end and does everything in the for loop run each time ? Let us know if it works out for you. Good luck!