It seems I am not replacing "word" with the star string, but instead I change every other word but it keeps the length of the "go" string. I'm not sure why this is, because I would think it looks for "word" and tries to replace that.
When i switch the if/else statement however, it doesn't replace anything anymore.
Your function fails on censor("Yo go fro yo go","go"). It returns "go ** go go **" when it should return "Yo ** fro yo **".
def censor(text, word): censored =  for i in text.split(): if i == word: censored.append("*"*len(word)) else: censored.append(word) return " ".join(censored)