Hello! I'm working on the exercise "Censor" :
For some reason, my code is only checking the first word in the phrase. It successfully checks the first word, but does not go on to check the rest. Is there something wrong with the way I set up my loop? Or did I screw up the syntax somewhere? Any help much appreciated. Thank you in advance. This is my last exercise in "Practice Makes Perfect." (And it's 1am and I should seriously be in bed. Got carried away again.) Yay!!
def censor(text,word): split_text = text.split() censored_phrase =  x = 0 if split_text[x] == word: split_text[x] = "*" * len(word) censored_phrase.append(split_text[x]) x += 1 else: censored_phrase.append(split_text[x]) x += 1 return " ".join(censored_phrase) print censor("this hack is wack hack", "hack") #returns "this"