Learn String Manipulation by Building a Cipher - Step 41

Tell us what’s happening:

i already use chatgpt and i did as it ask why stilkl wrong

Your code so far


# User Editable Region

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

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

# 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/131.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 41

your if need to be indented one more space.
You did more than asked, for example you should not add the else

The only thing you need to do is this:

At the top of your for loop, replace print(char == ' ') with an if statement. The condition of this if statement should evaluate to True if char is an empty space and False otherwise. Inside the if body, print the string 'space!' . Remember to indent this line.

you should have an if statement with a print inside, reset the step and add only this please