Hello, I’m currently not getting the desired output from my 2nd function, however my first function which is very similar does give the correct output, so I am unsure where I’m going wrong.
Here is my first function that does give the correct output:
def censor_word(text, word): return text.replace(word, '_____') print(censor_word(email_one, 'learning algorithms'))
And here is my 2nd function that is currently returning the full text of email_two but does not censor the specified words:
def censor_words(text, words): text_copy = text for word in words: text_copy.replace(word, '_____') print(word) return text_copy print(censor_words(email_two, proprietary_terms))
I added the print(word) call into the function to verify that I am getting the correct inputs, and I am, but they are not being replaced in text_copy.
Any help is appreciated.