At the beginning of your loop body, print the result of comparing char with a space (' ' ). Use the equality operator == for that.
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ' '
for char in text.lower():
char ==' '
print(char)
index = alphabet.find(char)
new_index = index + shift
encrypted_text += alphabet[new_index]
print('char:', char, 'encrypted text:', encrypted_text)
You should compare char with a space using the equality operator inside your for loop.
HELP ME PLEASE