Learn String Manipulation by Building a Cipher - Step 41

Tell us what’s happening:

i have tired many ways to do this and i am falling short can i get some help?

Your code so far


# User Editable Region

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

for char in text.lower():
    if 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_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 41

Welcome back to the forum @moboy2000

  1. You should replace print(char == ' ') with an if statement that triggers when char == ' '. Do not use parentheses to enclose the if condition and remember to include the final colon.

Part 1: The if statement is not an empty space.

Part 2: if true print space!

Happy coding

i did that and i have no idea where i went wrong

Please post your updated code.

it worked thank you
i just reset it and started over

1 Like