10/15 why is this wrong?


#1
def censor(text, word):
    total = text.split(word)
    asterisk = "*" * len(word)
    total = asterisk.join(total)
    print total
    
censor("This hack is wack hack", "hack")

This is working fine, but why is it saying this is wrong answer?


#2

Hi,
Yes , your code does work fine . And i too believe that there isn’t any actual error or something like that.
But if you notice in the instructions , it said that the string entered shouldn’t contain any uppercase letters.
And the string that you entered (“This hack is wack hack”) contains an uppercase .(the “T” in “This”). So you
could maybe try that and check whether it still gives an error.


#3

your function prints the censored string, it doesn’t return the censored string.


#4

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