10.censor


#1


Also tried instead of "for wor in cens" I did result="".join(cens) but that didn't work either

Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "['', '', '']" when it should return " *** ***".


def censor(text, word):
    a = text.split()
    b = "*" * len(word)
    cens=[]
    total = ""
    for n in a:
        if n == word:
            cens.append(b)
        else:
            cens.append(n)
    return cens
    
    for wor in cens:
        total = total + wor
    return total
    print total
    
        
    

print censor("Come here rude boy","boy")#would you give it up


#2

A post was merged into an existing topic: Honestly I have no idea what I am doing right now


#3