lolamontes69

Python / Censorship for dummies.

Jun 2nd, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. def censorship(inputstring):
  2.     bannedwords = ['tits','tit','titties']
  3.     splitstring = inputstring.lower().split(' ')
  4.     for b in range(len(splitstring)):
  5.         if splitstring[b] in bannedwords:
  6.             splitstring[b] = "X"*len(splitstring[b])
  7.     a = ' '.join(splitstring)
  8.     return a
  9.  
  10. inputstring = str(raw_input('Type in the evil sentence >'))
  11. print "\n\n",censorship(inputstring)
  12.  
  13. """ If you can't handle reading certain words in your mail
  14.    just add them to the bannedwords list
  15. """
Advertisement
Add Comment
Please, Sign In to add comment