Learn string manipulation by building a cipher - step 40

I’m not sure what I’m doing wrong…

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

Hello Elizabeth, welcome to the forum!

The code you posted above, is that your whole code?
If you do still have the variables above that, then this code passes for me.
If it isn’t for you, I would reset the step and do it again, making sure you don’t accidently touch anything above it.