Learn String Manipulation by Building a Cipher - Step 42

Tell us what’s happening:

the clue is still unclear to me i dont know waht else to do here plz give me some other clue plz

Your code so far


# User Editable Region

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

for char in text.lower():
    if 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/133.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 42

Hi there,

You have an if statement, but it’s missing the code inside to execute:

The lesson instructs:
"Instead of printing 'space!', use the addition assignment operator to add the space (stored in char) to encrypted_text"

You need to add a line inside the if statement to append the space to encrypted_text.

so the command is to print a space inside the if statement ?

1 Like

No, you need to combine the encrypted_text and char variables using the addition assignment operator (+=). (Don’t print anything)

1 Like