[Censor] It worked but was unable to get passed



Your function fails on censor(“hey hey hey”,“hey”). It returns “None” when it should return " *".

I ran it on IDLE and it worked but I just can’t get passed on the website. Any suggestion?

def censor(text, word):
  length = len(word)
  newtext = text.replace(word, "*" * length)
  print (newtext)

Thank you guys!


Hint, hint…

Not a very original solution, so must be copied. How about trying a solution that actually uses an algorithm, not a built-in. The lesson is not called practice makes perfect for show, but to indicate we should prractice (find multiple solutions).


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