Learn String Manipulation by Building a Cipher - Step 27

can anybody pls explain me this. what to do in it.

Your code so far

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

# User Editable Region

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

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 27

What of the instructions is confusing? You need to do something really similar to what you did in the first few steps

Inside the for loop, before printing the current character, declare a variable called index and assign the value returned by alphabet.find(char) to this variable.

Tell us what’s happening: where is the mistake?

can anybody pls explain me?
Describe your issue in detail here.
I can’t figure out, what to do…

Your code so far

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

# User Editable Region

index = alphabet.find(char)
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/122.0.0.0 Safari/537.36 Edg/122.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 27

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.
Learning to describe problems is hard, but it is an important part of learning how to code.
Also, the more you say, the more we can help!

you can’t use char before creating it, your new line of code has to go inside the loop

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.
Learning to describe problems is hard, but it is an important part of learning how to code.
Also, the more you say, the more we can help!

sorry, but can you pls tell me the codes

I’m starting learning.
Content is very helpful.
Thanks!

You need to move your new line inside the loop, you are almost there!

1 Like

Hi ilenia, thank you for explaining. it helped go to the next step. i had a similar issue trying to understand what i needed to do here. My issue is the wording used in freecodecamp. Sometimes it makes sense to me and other times it doesn’t. I thought it was asking me to make a new code above the for loop with index = "alphabet.find(char)

It literally says “Inside the for loop” as first four words. How would you change that to make it more clear?

Please open a new topic for your question, thanks!