Learn String Manipulation by Building a Cipher - Step 38

Tell us what’s happening:

the step 38 wouldn’t just go through can’t see what i’m missing

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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 38

Tell us what’s happening:

Describe your issue in detail here.

Your code so far


/* 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 38

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.

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.

I have merged your two topics, please create one topic only for each challenge

you should not use paretheses in the if statement condition

thanks got the problem fixed finally but the lesson did not state that parenthesis shouldn’t be used in if statements. thanks freecodecamp but we need to do better

1 Like

well, nowhere there is written you should use them

1 Like

thanks for the help what country are you chatting from?

how is that relevant?

NVM, I apologize
would just continue with my lesson

Where does it say anything about an if statement in the instructions? I’m struggling with the same problem and believe there is a bug here.

step 38 now doesn’t have an if statement

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.