Advertisement
Guest User

Untitled

a guest
Sep 16th, 2017
92
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()
  3.   new_text = ""
  4.   for item in text:
  5.     if word == item:
  6.       for i in item:
  7.         new_text += "*"
  8.       new_text += " "
  9.     else:
  10.       new_text += "%s " % item
  11.   return new_text
  12.      
  13. print censor("hey holla hey hey","hey")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement