View difference between Paste ID: dbF9fH4t and JHamJQeY
SHOW: | | - or go back to the newest paste.
1
def censor(text, word):
2
    result = ""
3
    text = text.split()
4
    for c in text:
5
        if c == word:
6
            c = "*" * len(word)    
7
        result = result + ' ' + c
8
    return result
9
   
10
11-
print censor("hey hey hey", "hey")
11+
print censor("hey hey hey", "hey")
12
13
14
Oops, tente outra vez. Sua funcao falha em censor("hey hey hey","hey"). Ela retorna " *** *** ***" quando deveria retornar "*** *** ***".