Censoring Bug?


#1



15.10


My house ** a big house in my **land
None


def censor(text, word):
    txtsp = text.split(word)
    strr = ""
    wordlen = len(word) * "*"
    for x in text:
        if x in word:
            strr = txtsp
            return wordlen.join(strr)
print censor("My house is a big house in my island", "is")


Replace this line with your code.

As you can see, this is how I solved the censor exercise, however even though I passed the lesson with my code, the output is wrong I believe as it returns My house is a big house in my island instead of My house ** a big house in my **land Am I missing something?


#3

Might not be the most efficient code but it works for me...


#4

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