I’m struggling to pass the step four of this project. The part when you’re asked to uncensor ONLY the first occurrence of forbidden words. The second, third, etc occurrence should all be censored.
This is my code:
phrase3 = ["concerned", "behind", "danger", "dangerous", "alarming", "alarmed", "out of control", "help", "unhappy", "bad", "upset", "awful", "broken", "damage", "damaging", "dismal", "distressed", "distressing", "concerning", "horrible", "horribly", "questionable"] def **censorThree**(phrases, email): count = 0 for phrase in phrases: if phrase in email: while count < 1: count += 1 while count >= 1: for phrase in phrases: if phrase in email: email = email.replace(phrase, "[REDACTED]") return email print("\n\n\n\nPART 3") print(**censorThree**(phrase3, email_three))
And instead I censored all the forbidden words:
Board of Investors
Things have taken a [REDACTED] turn down in the Lab. Helena (she has insisted on being called Helena, we’re unsure how she came to that moniker) is still progressing at a rapid rate. Every day we see new developments in her thought patterns, but recently those developments have been more [REDACTED] than exciting.
Let me give you one of the more [REDACTED] examples of this. We had begun testing hypothetical humanitarian crises to observe how Helena determines best solutions. One scenario involved a famine plaguing an unresourced country.
Horribly, Helena quickly recommended a course of action involving culling more than 60% of the local population. When pressed on reasoning, she stated that this method would maximize “reduction in human suffering.”
This [REDACTED]ous line of thinking has led many of us to think that we must have taken some wrong turns when developing some of the initial learning algorithms. We are considering taking Helena offline for the time being before the situation can spiral [REDACTED].
More updates soon,
Francine, Head Scientist
What am I doing wrong?
Any help would be appreciated