Quotes help make search much faster. Example: "Practice Makes Perfect"

Thursday, November 29, 2012

Codecademy: censor


#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)

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts