Learn String Manipulation by Building a Cipher - Step 41

Tell us what’s happening:

I’m stuck at this step. My code seems to be working and I think I have the right indentation. I could really use some help here :wink:

Your code so far


# User Editable Region

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

for char in text.lower():
    if char == 'space!':
        print(char == 'space!')
    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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 41

The condition of this if statement should evaluate to True if char is an empty space and False otherwise.

An empty space string looks like this:

' '

You can refer to the previous step and how print(char == ' ') prints True or False