Khalon
Coder
Python:
def cleanText(text, censorList):
# your function should replace all censored words in the text with ****
pass # replace 'pass' with your function content
theText = "A baby donkey is called an ass not an idiot!"
theCensorList = ["ass", "idiot"]
print(cleanText(theText, theCensorList))
# output should be "A baby donkey is called an **** not an ****!"
# HINT: You can create a loop that goes through all words in the censorList, for each censored word, replace every occurrence of that word in your text with ****
I know there are multiple ways to do this but, I can't understand how they wanted me to do this in their hint.