So, I nearly solved the problem with the following method, but I kept ending up with one space too many. I then tried the list route and got overly frustrated with that, so now I'm back to the if loop method. I added the while loop to try to remove the space that throws off the output.
def censor(text, word): x = "" b = text.split() c = len(b) d = 0 for n in b: if n == word: n = "*" * len(word) d = d + 1 while d < c: x = x + (n + " ") else: x = x + n return x
it threw a "" error