Hi coders, I am currently struggling with Censor Dispenser challenge of python. I did quite a bit research but I am not able to crack this problem.
# These are the emails you will be censoring. The open() function is opening the text file that the emails are contained in and the .read() method is allowing us to save their contexts to the following variables: email_one = open("email_one.txt", "r").read() email_two = open("email_two.txt", "r").read() email_three = open("email_three.txt", "r").read() email_four = open("email_four.txt", "r").read() proprietary_terms = ["she", "personality matrix", "sense of self", "self-preservation", "learning algorithm", "her", "herself"] def censor(email, word): list_to_string = "" hashes = "#" * len(word) email_censor = email.replace(word, hashes) return email_censor email_split = email_two.split() list_to_string1 = "" def email_advance(mail, words): global list_to_string1 edit_email = [''] edit_email = email_split for i in edit_email: for b in words: list_to_string = " ".join([str(i) for i in edit_email]) if i in b: hashes = "#" * len(i) list_to_string1 = list_to_string.replace(i, hashes) edit_email = list_to_string1.split() else: break return edit_email print(email_advance(email_two, proprietary_terms))
This is what I have done till now.
I will be really helpful if any of the coders out there can help to get me through it.
Thanks In Advance and Have a nice day.
My Progress With This Challange.