im getting following error , i tried various methods but I somehow cant find the solution.
// running tests
You should compare char with a space using the equality operator inside your for loop.
You should print the result of comparing char with a space inside your for loop.
You should print the result of comparing char with a space at the beginning of your loop.
// tests completed
Your code so far
# User Editable Region
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
for char in text.lower():
print('char' +'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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 41
no, you need to compare with something different from itself, otherwise the comparison doesn’t make sense. One member of the comparison is char, which you did correctly, now you need to have the other member of the comparison a string that contains only a space