Censor code works in idle but receiving error


#1



Censor


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


No error, able to proceed to next lesson


def censor(text, word):
	newtext = text.split()
	key = 0
	for tword in newtext:
		if tword == word:
			newtext[key] = "*" * len(tword)
			key += 1
		else:
			key += 1
	sp = " "
	sp.join(newtext)


#2

you need to return the censored string


#3

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