Learn String Manipulation by Building a Cipher - Step 41

Tell us what’s happening:

it says: print the result of comparing char to a space.
this is my code and it doesn’t work.

print(char == ’ ')

Your code so far


# User Editable Region

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''

for char in text.lower():
    index = alphabet.find(char)
    new_index = index + shift
    encrypted_text += alphabet[new_index]
    print('char:', char, 'encrypted text:', encrypted_text)
    ('char' == ' ')

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 41

You’re very close. For this challenge, at the beginning of the for loop, you need print the result of the char variable being compared for equality to a white space.

Hope this helps. :slight_smile:

If you have any further questions let me know.