Describe your issue in detail i am stuck at this level, i am following the instructions and improving my code many times but still its not working. Exactly where i have to put that addition .
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+=alphabet[new_index])
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/109.0.0.0 Safari/537.36
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 43
You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.
Learning to describe problems is hard, but it is an important part of learning how to code.
Also, the more you say, the more we can help!
You dont need any print becouse!It says instead of printing 'space!'.
Also at the space of print add encrypted_text. and use the additon assignment +=. and put char on it!
Happy coding
Here is a comparison between the original code and your new code.
The code in red is your new code.
The code in blue is the original code.
Code in magenta is the overlap.
You appear to have changed the indentation of the code.
Please reset the step to restore the original code.
Now, instead of printing 'space!' , use the addition assignment operator to add the space (currently stored in char ) to the current value of encrypted_text .