Practice makes perfect - Censor


#1

Hello!

I’m getting stuck at the censor exercise, my code is working and returning me the right value but the website won’t let me pass through the next section.

Can anyone help me pointing out what I’m doing wrong?

Thank you!



def censor(text, word):
  
  splitText = text.split()
  newText = ""
  ast = "*" * len(word)
  
  for i in splitText:
    if i == word:
      i = ast
    else:
      i = i
      
    newText += i + " "
    
  " ".join(newText)
  
  return newText

print censor("Je suis un koala", "koala")



#2

The length of the text(the argument you pass) shouldn’t be change.

notice It creates a space at the end.


#3

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