Censor Dispenser Error

Hello Y’all, looking for some help with my code…again!

def censor_email_two(email_2, lst):

email2= list(email_2)

email= email_2.lower()

for terms in lst:

index= 0

while index < len(email):

  index= email.find(terms, index)

  if index == -1:

    break

  if email2[index -1] == " " or email2[index -1]== "\n" or email2[index -1] == "(":

    for i in range(index, index+ len(terms)):

      email2[i]= "x"

  index+= len(terms)

email2= “”.join(email2)

return email2

ef censor_three(email, lst):

email= censor_email_two(email, lst)

email3= list(email)

for word in neg_words:

index= 0

if index < len(email3):

  index= email.find(word)

  for i in range(index, index + len(word)):

    email3[i]= "x"

print("".join(email3))

censor_three(email_three, proprietary_terms)

END CODE

So my problem is that “board o” in “Board of Investors” is also being “x”'d out, and I have no idea why.
If you are familiar with the project, I could use some help!

Hello! Could you review ->this<- post on how to format your code?

1 Like