Censor(completely confused)


#1

Can someone explain to me the censor project? I don't get it, I've tried to write the code for it and it doesn't work.

def censor(text, word):
ast = '*' * len(word)
string = text.split()
if word in text:
print text + ast


#2

In this small project.

1.Our input is a sentence say y and a word say z (censor word)
2.Our goal:
We have to censor every word z present in y.

How to approach this ?

One way can be..

Split the sentence y into words using split() and compare every word with censored word z ,if we find it we replace that word with **** (if censor word is 4 character long) and finally return the censored string/sentence.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.