Learn String Manipulation by Building a Cipher - Step 23

Tell us what’s happening:

Describe tu problema en detalle aquí.

Your code so far


/* User Editable Region */

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
index = alphabet.find(char)
for char in text:
    print(char)

/* User Editable Region */

Your browser information:

El agente de usuario es: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 23

This code is correct,

index = alphabet.find(char)

but you can’t use a variable outside its scope, “char” only exists inside the place it was created

char was created in the for loop

for char in text:
    print(char)

so you have to change the position of your line of code

/* User Editable Region */

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
index = alphabet.find(char)
for char in text:
    print(char)

/* User Editable Region */
2 Likes

can you edit me the code please if you dont mind so its okay . Sorry for being dumb

Never mind my IQ is below 10 im learning i wish you a merry christmas and thanks for giving me a lesson . print(“<3”)