#sample solution
def censor(text,word):
wordsInText = text.split()
censorString = ""
for i in range(len(word)):
censorString = censorString + '*'
#print "The censor string is: " + censorString
for index, individualWord in enumerate(wordsInText):
if word == individualWord:
#print "found match"
wordsInText[index] = censorString
return " ".join(wordsInText)
def censor(text,word):
wordsInText = text.split()
censorString = ""
for i in range(len(word)):
censorString = censorString + '*'
#print "The censor string is: " + censorString
for index, individualWord in enumerate(wordsInText):
if word == individualWord:
#print "found match"
wordsInText[index] = censorString
return " ".join(wordsInText)
No comments:
Post a Comment