Censor


#1

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)



#2

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)?


#3

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