Censor 10/15

def censor(text,word):
    count= " "
    for i in new:
            count+= '*'*len(word)+" "
            count += i + " "
    print count
censor("I live in city of Joy kolkata ","city")

this code runs perfectly in my IDE but throws a error in the console.
Can anyone explain why?


lets say we have this function call:

censor("hey hey hey", "hey")

and we would call your function, the result would be:


i replaced the spaces with underscores, as you can see, we have an additional space at the end of our sentence, that is not suppose to be, which is why you get an error


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