Censor: don`t understand


#1

why this code is right?

def censor(text,word):

    b=text.split(word)

    c=('*'*len(word)).join(b)
            
       
    return c

#2

i ran your code:

def censor(text,word):

    b=text.split(word)

    c=('*'*len(word)).join(b)
            
       
    return c
print censor("this hack is a wack hack","hack")

(added a function call), it outputs right and it passes, maybe refresh the page/different browser? Your code is fine.

Interesting solution, not one you see everyday :slight_smile:


#4

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