When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!
If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer!
Can anyone help me? I am on the last part of Censor Dispenser: https://www.codecademy.com/practice/projects/censor-dispenser
question 3, where there are a list of words in a list that need to be censored in a block of string text. I’ve scoured the forums and the internet for a solution but can’t find any way to do this in a way that works. Below is my code so far:
def censor_list (cen_lst, text): new_text =  text_list = text.split(" ") for i in cen_lst: for n in text_list: if i == n: n = '*'*len(n) new_text.append(n) else: n = n new_text.append(n) return " ".join(new_text) proprietary_terms = ["she", "personality matrix", "sense of self", "self-preservation", "learning algorithm", "her", "herself"] print(censor_list(proprietary_terms, email_two))
Any help would be greatly appreciated.