Censor: Not returning full Text



def censor(text,word):
    for i in text:
        for j in word:
            if i==j:
    return word

What is going wrong? Is my Loop being stopped after just 1 iteration?


Your code is doing what you want it to do, that is: if text has a faul word, replace it with "*".

But the problem is, we want "*" * len(word), so that we get the input, our problem wants, "*** *** ***"
Instead of "***"


That means it's basically replacing the words not the letters! right?


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