Hey to any one reading this I already try everything i can think of to try to get this right but nothing is working the way it should I try to go to the forus and i try to do everything that they have place there and us my knowledge and still nothing have go my way to fix this. can someone tell me what im doing wrong please and thank you
#this is what i have so far
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ' '
for char in text.lower():
if char == " ":
encrypted_text += " "
index = alphabet.find(char)
new_index = index + shift
encrypted_text += alphabet[new_index]
print('char:', char, 'encrypted text:', encrypted_text)
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.