text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
for char in text.lower():
print(char == ' ')
index = alphabet.find(char)
new_index = (index + shift)
encrypted_text += alphabet[new_index]
print('char:', char, 'encrypted text:', encrypted_text)
and it keeps saying that i need to You should replace new_char
with encrypted_text
inside your for
loop. And i did and its still not working Can sombody please provide the correct code because i have been stuck on this for days
Please post a link to the step
No, that is not allowed on the forum.
Welcome to the forum @Helllo19371
Why are you printing a comparison between char
and a single space?
You also modified the code by placing parentheses around index + shift
. Your code is also concatenating alphabet[new_index]
to encrypted_text
instead of assigning the value.
Please reset the step to restore the seed code.
Only modify the code you are asked to modify.
Happy coding
thats wrong btw its suppoised to be alphabent btw ur doing it wrong btw
You’re not really helping yourself with a reply like this. Do you want to take a breather and try it again?
You have 2 replies from from people trying to help you. One is asking for a link to the problem you are working on for context. The other has some advice you can try implementing.
Try following the advice and let us know if you have any follow up questions.