Learn String Manipulation by Building a Cipher - Step 41

Tell us what’s happening: i’m stuck I don’t know what to do I’ve reset the exercise multiple times already and I can’t figure out what to do I was told once before that operator I used was an empty string with that being said I’ve read multiple forms about this topic and I still can’t figure out what the issue is.

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():
    char == ' '
    index = alphabet.find(char)
    new_index = index + shift
    encrypted_text += alphabet[new_index]
    print('char:', char, 'encrypted text:', encrypted_text)
    print()

# 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/121.0.0.0 Safari/537.36 OPR/107.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 41

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.

What are the instructions for this step? Also, what error messages did you get?

Hi @averywm070601

At the beginning of your loop body, print the result of comparing char with a space (' '). Use the equality operator == for that.

You need to place the print call in the correct spot.

Happy coding

I did that and it didn’t work

Hi @averywm070601,
You may want to check this out.

It should help you resolve it.

thanks for the help but once again the result of my code returned false even when I print the word char in the next line of code in the loop the terminal spaces the words out like its supposed too but when I run the code it keeps telling me that I should pass it through the for loop and I’ve done that every time but it doesn’t work I’ve reset it a bunch of times too and every time It gives me the same hint every time so at this point i’m annoyed and frustrated.

Can you share your code

The line after the for loop should be a print function. What you have on the line currently will be in the bracket of the print function.

Remove the last line of printfunction that has no parameter.

:+1: happy coding

I have just describe what to do.

Let me know if it works.

okay i’ll see if that works


for my understanding of what they are asking everything I just did should be correct

Your screenshot seems not to have content

But you may be have already entered something wrong somewhere.

Just reset. Then, read and understand the helps provided. You have to act on only the line after the for loop.

:+1: happy coding

It’s best to avoid posting screenshots, as clearer and simpler to post your code.
Anyhow, the instructions are to :

print the result of comparing char with a space (' ' )

Your code :

char == ' '
print(char)

prints the current value of char, as set by each iteration of the for loop.
The first line should be inside the print call, to print the result of comparing char with a space (' ').

1 Like

Hey @averywm070601 !
To my understanding you need to delete the last ‘print()’ call.
What you need to do as for the line under ‘for char in text.lower():’ is add something. I’ll give you a hint it starts with ‘pri’ and ends with ‘(…)’.

Also, a word of advise, next time, try to summarize what the instructions are telling you, you were likely just overthinking it. Don’t stress. It has negative impacts on coding.

:+1: Happy coding. (And remember don’t stress​:wink:)

i think you need to put a colon at the end of the block after the quotation marks

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