Learn String Manipulation by Building a Cipher Step 27

I have been trying to answer this question since last week and I can’t find the reason why I keep being denied. I understand that we’re trying to change the first letter of text through index and the loop. But I just don’t understand the formatting for text[0] or if I have something else wrong, I’ve looked around and tried to find a solution but I just can’t figure it out.


text = 'Hello World'
h = text[0]
h = 'g'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'

for char in text.lower():
    index = alphabet.find(char)
    print(char, index)
    new_index = index + shift

Instructions don’t mention to print index. The assignment is fine but I would reset this step and try it again, I think you may have changed other parts of the code.

You’ve changed / added way too much code. Just reset the step and add the one line asked for in the instructions.

Thank you, just did it again and reviewed with a friend who’s learning with me, I realized after some research around the forums that when the question says IN the for loop in doesn’t mean in the function in means under it with indentation. And the other stuff that I was typing in was later on most likely. This is a great relief :slight_smile:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.