Learn String Manipulation by Building a Cipher - Step 26

Tell us what’s happening:

where do i have to put index as a variable before “for” or as a new line or something

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

Inside the for loop

This means after the for line which establishes the loop and indented.

In the original code:

for char in text:
    print(char)

print(char) is inside the for loop.

it says You should declare a new variable named index at the beginning of your for loop.

1 Like

That’s correct. Did you have any other questions?

so i should do index = for char in text:
print(char)

No you should create the index variable on the line AFTER the for line

Just open 1 topic per step please