i dont understand what censor function suppose to do ?? i dont understand for real what iam suppose to do exactly?
You are supposed to replace certain words from a sentence with ****.
The function allows you to use any sentence and take any word you like.
You have to figure out if your sentence contains the word you want to censor and then figure out how to replace it with **** to hide that word and print the new sentence.
@letmeprogramyou1 The direction ask you to make a function in which it will take in a handful of words and another word which will censor the designated word you choose to have removed. Do you understand the instructions now?
yes thanks a lot i understand i already understand before you write this thanks for help i was little confused
def censor(text, word): k =  x = text.split() for string in x: if string == word: string = ("*" * len(string)) k.append(string) else: k.append(string) final = " ".join(k) print final return final censor("Yesterday I was eating", raw_input())
I hope it helps.
string = ""
string = text.replace(word,"*" * len(word))
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.