-
-
Save codecademydev/e575de572a0f368b0cd2e85fbcaaa923 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def censor(text, word): | |
text = text.split() | |
phrase = [] | |
phrase.append(text) | |
for each in phrase: | |
if each == word: | |
return "*" * len(word) | |
else: | |
return each | |
return " ".join(phrase) | |
print censor("Hey there friend", "friend") | |
"""phrase = [] | |
words = "This is a string of words" | |
words = words.split() | |
phrase.append(words) | |
print phrase""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment