Can someone please explain how this code is wrong? It puts out the output: (the password is ****
*** *** ***)
So why am I getting this error?
[Your function fails on censor(“hey hey hey”,“hey”). It returns " 3 asterisk"
when it should return "3 asterisk ".]
edit: I had to put in the words 3 asterisk as the reply wouldn’t show them. There is a space after the asterisks it says I should have gotten.
Makes no sense to me
def censor(text, word): final = "" lst = text.split() for i in lst: if i == word: i = "*" * len(i) final = final + i + " " else: final = final + i + " " print final return final