I don’t know what’s wrong with my code

def censor(text,word):
  text = text.split(text)
  for i in text:
    if i == word:
      i = "*"*len(word)
  return " ".join(text)


i (loop iterator) contains read only values from the list, any changes made to it won’t persist

How could we find a way to make the changes persist? Maybe a list or a string? Or update the existing list (which requires indexes)?


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