Learn String Manipulation by Building a Cipher - Step 37

Tell us what’s happening:

pls tell me how to do it i am doiing it for a long time

Your code so far


# User Editable Region

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
new_char = alphabet[new_index]

for char in text.lower():
    index = alphabet.find(char)    
    new_index = index + shift
    encrypted_text = ""
    print('char:', char, 'new char:', new_char)

# 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/131.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 37

replace new_char with encrypted_text

encrypted_text = ""

You replaced the new_char variable :white_check_mark: but why did you change the assignment to an empty string? Instructions do not say to do that.

modify the print() call into print('char:', char, 'encrypted text:', encrypted_text) to reflect this change

print('char:', char, 'new char:', new_char)

You didn’t replace this line, you still have new_char

You also were not supposed to change line 4. Leave the encrypted_text assignment alone there.

Just change the last two lines as instructed, replacing the new_char variable for encrypted_text