Problem with step 49_indentation error

Hi everyone,

I’m currently working on Step 49 of the Caesar Cipher project on FreeCodeCamp.

I keep getting this error message:

“Your code has an indentation error. You may need to add pass on a new line to form a valid block of code.”

I tried using def and if as required, but it still doesn’t work.

Here’s my code:

def encrypt_text():

    text = 'Hello World'

    shift = 3

    alphabet = 'abcdefghijklmnopqrstuvwxyz'

    encrypted_text = ''

    for char in text.lower():

        if char == " ":

            print("space!")

        else:

            index = alphabet.find(char)

            new_index = index + shift

            encrypted_text += alphabet[new_index]

            print('char:', char, 'encrypted text:', encrypted_text)

encrypt_text()

Can someone please help me figure out what’s wrong?

Thank you!

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

is this the step?

if it’s so, you are not asked to create encrypt_text function, please read the instructions more carefully

you also have a lot of code that should not be there for step 49. Please confirm what step you are asking help for