I set my index variable at 0 with the intent to increase it by 1 with each iteration. For some reason, the index reaches 1 and then will not go any higher.
Error message: Oops, try again. Your function fails on censor("hey hey hey","hey"). It returns "*** hey hey" when it should return "*** *** ***".
I want my "index" variable to increase by 1 with each loop iteration, that way my split[key] call will replace the appropriate word.
def censor(text, word): split = text.split() print split for phrase in split: index = 0 if phrase == word: split[index] = "*" * len(phrase) index = index + 1 print index new_text = " ".join(split) return new_text censor("I am your Father", "your")