Learn String Manipulation by Building a Cipher - Step 38

Tell us what’s happening:

Is my code wrong?

Your code so far

/* User Editable Region */

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
if char == ' ':

for char in text.lower():
    print(char == ' ')
    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/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 38

that’s not at the top of the loop

put above lines inside for loop by replacing below line

“At the top of the loop” means, within the loop, but the first thing in the loop (After the for statement)

same issue here, what could else could be wrong

Hello Mohamed, welcome to the forum!

You will have to remove the round brackets in the if statement, in phyton you don’t need them.

Also if you have any further questions I would recommend making your own topic by using the help button under the step so we can all help you better.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.