Learn String Manipulation by Building a Cipher - Step 41

Tell us what’s happening:

I have completed the directions. But, it’s saying that it’s wrong still. What is wrong with my code? :slight_smile:

Your code so far


# User Editable Region

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

for char in text.lower():
    if char != ' ':
        print(' ')
    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 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 41

Hello,
The if statement that you added evaluates to true if it is not equal to an empty space while in the instructions, this should be the opposite so replace != with == then you should print space! not an empty string