+ All Categories
Transcript

Python programming

Lab 16

def censor(text, word):

list1 = text.split()

newlist = []

final_list = []

for w in list1:

if w == word:

newlist.append("*" * len(word))

else:

newlist.append(w)

final_list = " ".join(newlist)

return final_list


Top Related