Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. def censor(text, word):
  2.     text = text.split() #split text string into a list.
  3.     for i in range(len(text)): # get the index?
  4.         if text[i] in word: # if list[i] in word
  5.             text[i] = "*" * len(text[i]) #change letters to *
  6.     return " ".join(text) # rejoin the string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement