Censor


#1

def censor (text, word):
new_str = text.split("")

for i in text:
    new_str = new_str.replace(i, "*")
    final = " ".join(new_str)
return final


After, little research I managed to think like this, but it still generating an error of :Oops, try again. Your code looks a bit off--it threw a "empty separator" error. Check the Hint if you need help!...

Can anyone Please help?. and also I also want to know basics of spilt() and join() function.


#2

new_str = new_str.replace(i, "*")

replace() method can't be used on list.

when you apply split() on text it converts into a list.

resources on split and join..

http://www.pythonforbeginners.com/dictionary/python-split
https://www.tutorialspoint.com/python/string_join.htm


#5

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