Censor not working BUGGED?


#1

here is my code for the "censor" problem

def sensy(word):
sen = ""
for char in word:
sen += "*"
return sen

def censor(text, word):
global o
output = text.split()
for key in output:
if key == word:
key = sensy(word)
o += key
o += " "
return o

print censor("hey hey hey crap", "crap")

for some reason im getting:

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

Annoying


#2

It tells you that you returned one string and tells you what it expected instead. Compare them, they are different.

Take care to get the formatting of your code right, it's far more difficult to figure out what's wrong with your code when you post something that is different from your code. Far less inviting too.