Learn String Manipulation by Building a Cipher - Step 50

Tell us what’s happening:

can anyone help me it is showing me some indent error and not able to get it

Your code so far

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/124.0.0.0 Safari/537.36

text = 'Hello Zaira'
shift = 3
def caesar ():
        alphabet = 'abcdefghijklmnopqrstuvwxyz'
        encrypted_text = ''
        for char in text.lower():
            if char == ' ':
                encrypted_text += char
            else:
                index = alphabet.find(char)
                new_index = (index + shift) % len(alphabet)
                encrypted_text += alphabet[new_index]    
        print('plain text:', text)
        print('encrypted text:', encrypted_text)
caesar()

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 50

You should indent all the lines after shift = 3 so that they become your new function body.

You are missing one line, the last line of code is not indented

made changes but still not able to solve without calling function

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

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

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

1 Like

with or without the function call your code passes, the function call is irrelevant for the tests

1 Like

Thankyou for considering my request