Learn String Manipulation by Building a Cipher - Step 42

Tell us what’s happening:

help! me please i am stuck and dont know what happened

Your code so far


# User Editable Region

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

for char in text.lower():
    if char == ' ':
        print('char += encrypted_text')
    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 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 42

why are you printing this line above and putting it into a string? Think about it when you are printing ‘char += encrypted_text’ thats what the output is on the terminal it doesn’t say put that on the terminal but rather it says “use the addition assignment operator to add the space” so think what do you need to do here to actually add these VARIABLES and not quite literally print them on the terminal

1 Like