Learn String Manipulation by Building a Cipher - Step 48

Tell us what’s happening:

i don’t understand what i am supposed to do!!! i understand the qst but all forms i do it’s false

Your code so far


# User Editable Region

text = 'Hello Zaira'
shift = 3
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 , '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/126.0.0.0 Safari/537.36 Edg/126.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 48

Hi @guedouah.asma27,

The instructions want you to add the new print statement above print('encrypted_text:', encrypted_text') at the start of the step. So you’ll end up with two print statements on top of each other.

The preview output you’re looking for is:

plain text: Hello Zaira
encrypted text: khoor cdlud

I hope this helps. Happy coding!

1 Like

i did that but still tells me " Your code has an indentation error. You may need to add pass on a new line to form a valid block of code.’

Your initial encrypted_text (line 4) should not be indented. Remove the space before it. And the beginning of the for loop (line 6) should not be indented. Remove that space as well. Happy coding!