Loops never work, and the .replace() method doesn't do anything at all.

Ive spent like half an hour at this one exercise, can someone please give me the solution :frowning:

Replace this line with your code.


asking and giving solution is not according to the guidelines

please copy paste your code to the forum, so we can help you understand your problem, improve your understanding and work toward a solution


def censor(text, word):
new_text = text.replace(word, "*" * len(word)
return new_text the indent disappears when i post this to the forum
The errors I got:

  1. File "python", line 3
    return new_text
    SyntaxError: invalid syntax

  2. Your code threw a "global name 'censor' is not defined" error.


look at your parentheses on the line above return, the number of opening parentheses doesn't match the number of closing parentheses


wow... That was surprisingly simple, Thank you so much!


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