Hi, can you help me see what’s wrong with my code? I’m getting an “an integer is required” error. Also, is there a more efficient way to accomplish the task in this exercise?
Here’s my code:
def censor(text, word): list = text.split(" ") star = "*" * len(word) for badword in list: if badword == word: word = list.index(badword) list.insert(badword, star) list.remove(badword) return " ".join(list)