Learn String Manipulation by Building a Cipher - Step 26

Tell us what’s happening:

it says to put index at the beginning of the for loop and i did index for char in text:
print(char)
is that right or wrong

Your code so far

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

# User Editable Region

index for char in text:
 print(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/126.0.0.0 Safari/537.36 Edg/126.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 26

Hi there,

What the instruction meant by “at the beginning of the for loop” is like this:

for char in text:
    __put_your_code_here__

What we need to do is:

declare a variable called index and assign the value returned by alphabet.find(char) to this variable

why does it say: You should declare a new variable named index at the beginning of your for loop.

for char in text:

index = alphabet.find(char)

We declare index inside the for loop, so it has to be indented. Like this:

thank you so much dude

this actually gave me pain so bad for ten minutes i been doing the same code over and over almost don’t mistake your code take off the print() it will make you understand better.