I'm trying to do the censor function, but it wont return to me the whole text, only the word that is censored out. Why doesn't it loop through all the words in the text? What can I do to this code to make it work?
def censor(text,word): text=text.split() for c in text: if c==word: c="*"*len(c) else: c==c return c text="".join(text) return text
when I run the code it gives me this error message.
Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "" when it should return " *** ***".
Replace this line with your code.