My brain is so fried from this one I can’t tell if I did this correctly, or completely overthought it. I think this returns the correct string, but if someone can point me in the right direction that would be great. For some reason I can’t find the solution online to compare myself to. Thanks!
def censor_email_three(email, terms): email_split = email.split(" ") censored_terms =  count = 0 for term in terms: censored_term = "" for i in range(len(term)): if term[i] == " ": censored_term = censored_term + " " else: censored_term = censored_term + "*" censored_terms.append(censored_term) for i in range(len(email_split)): for x in range(len(terms)): if email_split[i] == terms[x]: count += 1 if count == 3: for y in range(len(terms)): for b in range(i, len(email_split)): if email_split[b] == terms[y]: email_split[b] = censored_terms[y] email_final = " ".join(email_split) censored_email_final = censor_email_two(email_final, proprietary_terms) return censored_email_final