Learn String Manipulation by Building a Cipher - Step 33

Tell us what’s happening:

my code that i type is still error can you help me for that can you give the correct code?

You should set your new_char variable to alphabet[new_index] at the end of your loop body.

Your code so far

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\]  # new_char set at the end of the loop

print(new_char)

# 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]  # new_char set at the end of the loop
    print(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/140.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 33

you added something extra that was not asked for