Censor


#1




It says "Oops, try again. Your code looks a bit off--it threw a "list assignment index out of range" error. Check the Hint if you need help!"


def censor(text, word):
    text = text.split(" ")
    count = 0
    for i in text:
        count = count + 1
        if i == word:
            text[count] = "*" * len(word)
    text  = " ".join(text)
    print text


censor("Hi I'm Ruby", "Ruby")


#2

Increment count after the if statement. Remember to return your string, not print it.


#3

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