Learn String Manipulation by Building a Cipher - Step 38

Tell us what’s happening:

Describe your issue in detail here.
The error hint keeps telling me to remove the print(char == ’ ') even though I’ve done that and even reset the code to try again…

Am I totally missing something?

Your code so far

text = ‘Hello World’
shift = 3
alphabet = ‘abcdefghijklmnopqrstuvwxyz’
encrypted_text = ‘’

for char in text.lower():
if char == ’ ’
print(‘space!’)
index = alphabet.find(char)
new_index = index + shift
encrypted_text += alphabet[new_index]
print(‘char:’, char, ‘encrypted text:’, encrypted_text)


/* User Editable Region */

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

for char in text.lower():
    if char == ' '
        print('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 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 38

1 Like

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Hello DTubbs,

Your if statement is missing the semi colon at the end.

1 Like

lol thank you! the error text was throwing me off HARD

Do not use parenthesis in if statement:

Solution removed

Hi, thanks for helping out but:

  1. This was already solved 5 days ago
  2. They didn’t use parentheses
  3. Please don’t post full solution code