10/15 Censor - replacing word


I’m struggling to understand why my code doesn’t replace the word with stars…can anyone help?

def censor(text, word):
  new_text = text.split()
  star = "*" * len(word)
  for i in range(0,len(new_text)-1):
    if new_text[i] == word:
       new_text[i] == star
  return " ".join(new_text)



new_text[i] == star

two equal signs means check if equal, is that really what you want to do here?


No, it’s not! Thanks


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.