Learn String Manipulation by Building a Cipher - Step 40

Tell us what’s happening:

Please explain to me what went wrong.

Your code so far

/* User Editable Region */

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

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)

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

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 40

Hello Atabek,

The questions mentions “add an else clause after encrypted_text += char and indent all the subsequent lines of code.”
It looks like you did indeed add an else clause, but you didn’t ident the lines of code afterwards. Once you do so, you can also remove the break as it’s not necessary anymore.

It really helps if you talk to us about what in the instructions or error message is confusing. Communication is a critical programming skill that takes a lot of practice to get good at. And the more you say, the easier it is for people to help you

To fix this situation, add an else clause after the ciphertext += and delimit all subsequent lines of code.