Instead of printing space!, use the addition assignment operator

Hello dear friends. My task is that: instead of printing space!, use the addition assignment operator to add the space to the current value of encrypted_text. So I wrote following. But it still make error. Please help6

for char in text.lower():
    if char == ' ':
            encrypted_text += char

Please, share your whole code. See this to format it properly: Learn by building RPG - Dragon Repeller step 93 - #5 by ilenia

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.

Although we would need to see your whole code, from this snippet it seems like your indentation is wrong. You should only have one extra tab or 4 more spaces in front of the encrypted_text line than the if line. (so 2 tabs, 8 spaces total).

You forgot your semicolon at the end of char

We don’t need semi colons in Python.

As @HungryBee pointed out, the indentation is not correct but in this particular case the test can pass. I suspect there’s another reason that is not making you pass this step.

You’re right but some python syntaxes allows it to end a statement which the ‘if’ statement is an example

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