Learn String Manipulation by Building a Cipher - Step 35

I am unable to cross this step, How to add the value of the same variable and assign it to the same variable?

Your code so far

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

# User Editable Region

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

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 35

variable1 = variable1 + variable2

u r partially correct but follow above syntax

1 Like

This is the line of code that you should fix. First erase " and the main question was: Instead of assigning alphabet[new_index] to encrypted_text , assign the current value of encrypted_text plus alphabet[new_index] to this variable. So when you added + after alphabet{new_index}, like this: β€˜alphabet[new_index] +’ you are on right track. Then, just do what the question asked. Simply after add encrypted_text variable with alphabet[new_index} to the current value which is encrypted_text.

List item

1 Like

thank you, I got this.

1 Like