Меня просят написать программу, которая заменяет слова в массиве test_tweets
, которые соответствуют словам в массиве banned_phrases
, на "CENSORED"
.
test_tweets = [
"This politician sucks!",
"I hate this Government!",
"I can't believe we're living with such a bad politician. We were so foolish",
"Politicianname is a danger to society. I hate that he's so bad – it sucks."
]
banned_phrases = ["sucks", "bad", "hate", "foolish", "danger to society"]
Я не могу понять, чтометод достигает этого.