Hello everyone who will see this code:) When I run my code, Python gives error:Oops, try again.Your function fails on censor("hey hey hey","hey"). It returns "******" when it should return " *** *** ***".
So, how can I make a space between same words? I used split command, but didn't understand how to put my word into that spaces.Here's my code:
s= "hey hey hey" def censor(text,word): counts =  for letter in text: asterisk = len(word) * "*" big_letter = letter.upper() if letter == "": continue elif big_letter in text: continue else: print text.count(word) counts.append(word) counts[0:] = asterisk if word in text > 1: word=asterisk*text.count(word) print text.split(word) return "".join(counts[0:]) print censor(s,"hey")