47
Python programming Lab 16

Python programming lab16

  • Upload
    profbnk

  • View
    153

  • Download
    3

Embed Size (px)

Citation preview

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