Learn String Manipulation by Building a Cipher - Step 41

Tell us what’s happening:

Describe your issue in detail here.

Your code so far


# User Editable Region

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

for char in text.lower():
    index = alphabet.find(char)
    new_index = index + shift
    encrypted_text += alphabet[new_index]
    print('char:', char, 'encrypted text:', encrypted_text)
    if char == " ":
        print()

# User Editable Region

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 41

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.

Hi @Hafis917

The instruction:
image

There is no mention of using an if statement.
The code needs to be the first line in the for loop.

Please reset the step and try again.

Happy coding

I am having the same problem. are we suppose to delete the “text.lower” i am just confused on where to put it.

No, if the instructions don’t mention deleting anything, then you don’t need to.

“At the beginning of your loop body”

This means the next line after the for statement. for creates the for loop, and the next indented line is beginning of the loop body, the code block that will be executed in a loop:

for char in text.lower():

If you have any more questions please open a new topic, thanks!