The question is telling me to replace new_char with encrypted_text. also modify the print() call into print(‘char:’, char, ‘encrypted text:’, encrypted_text) to reflect this change. I believe I have done that, but it’s telling me my code does not pass.I am very confused Could you point out my mistake
Your code so far
# User Editable Region
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
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
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 37
Your code is correct but has one extra and one missing element (special character). The lesson asked:
Now, replace new_char with encrypted_text. Also, modify the print() call into print('char:', char, 'encrypted text:', encrypted_text) to reflect this change.
Thank you, but the thing is i copied your code but it is still giving the same error.
You should turn your print() call into print('char:', char, 'encrypted text:', encrypted_text) inside your for loop.