def censor(text,word): l=len(word) wl= wl=text.split() text1="" s=" " for i in wl: if (i==word): text1+="*" * l else: text1+=i text1+=" " p=len(text1) text1[p]="" return text1
strings are immutable, so you can't do this:
if you want to get rid of the last character, use string slicing
thank you sir. I got it
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.