Hello everybody, i would like some help with the project I mention above.
To be more specific, I am currently on the last task, the one that asks me to censor everything from the given email_four.
This is my code:
censor_all = proprietary_terms + negative_words
def censor_four(input_text, censored_list):
splitted_text = input_text.split(" ")
for word in range(len(censored_list)):
if word in splitted_text:
this_word = splitted_text[word]
censored_this_word = ""
for i in range(len(this_word)):
censored_this_word=censored_this_word + "X"
input_text[this_word] = input_text.replace(this_word,censored_this_word)
word_before = splitted_text[word-1]
censored_word_before = ""
for i in range(len(word_before)):
censored_word_before = censored_word_before + "X"
input_text[word_before] = input_text.replace(word_before,censored_word_before)
word_after = splitted_text[word+1]
censored_word_after = ""
for i in range(len(word_after)):
censorer_word_after = censored_word_after + "X"
input_text[word_after] = input_text.replace(word_after, censored_word_after)
return "".join(input_text)
print(censor_four(email_four,censor_all))
Unfortunately all it does is to return the exact email_four with no changes at all. Any ideas why??
Thanks in advance!