-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFoulWords.py
More file actions
34 lines (27 loc) · 807 Bytes
/
FoulWords.py
File metadata and controls
34 lines (27 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'''
Created on May 12, 2017
@author: Administrator
'''
from random import randint
def filter(words):
x = words.split()
temp = ""
for a in range(len(x)):
temp += converFoulWords(x[a]) + " "
return temp
def converFoulWords(x):
list = ["abnoy","tanga"]
specialChar = ["*","@","#","!","~","^","%","*","!","&","*","@","#","$","#","<",">","?","+","!"]
word = ""
filteredWords = ""
if x.lower() in list:
for a in list:
if a == x.lower():
count = len(x)
for b in range(count):
pos = (randint(0,18))
word+=specialChar[pos]
filteredWords += x[0] + word
else:
filteredWords += x.lower()
return filteredWords