I wrote a "censor" function as follows
def censor(text,word): text=text.split() for x in text: if x==word: x=('*' * len(word)) return " ".join(text)
The exercise should be trivial: I split the input string "text", iterate through it, if I find the forbidden word I replace it with a number of * equal to the word length. I think I'm doing something wrong here:
x=('*' * len(word))
Thank you for your help!