Hey - im currently working on section two of the coding project censor dispenser. I’m having a weird issue i can’t seem to figure out… when i define my function, unless i redefine email_two WITHIN the function, i get an error message that my email_two has not been defined… even though it seems to clearly have already been defined earlier in the code. I’ve bolded both lines im talking about. The code below functions the way i hoped, but without defining email_two within the function, it fails.
Also, whats the best way to paste code into this forum?
here’s a link to the project: https://www.codecademy.com/practice/projects/censor-dispenser
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"] proprietary_terms_uppercase =  for term in proprietary_terms: proprietary_terms_uppercase.append(term.title()) # quest 2 def word_replace2(proprietary_terms, proprietary_terms_uppercase): email_two = open("email_two.txt", "r").read() for term in proprietary_terms: email_two = email_two.replace(term, "CENSORED") for Term in proprietary_terms_uppercase: email_two = email_two.replace(Term, "CENSORED") return email_two email_two_edited = word_replace2(proprietary_terms, proprietary_terms_uppercase) print(email_two_edited)