I wrote this code for the censoring practice, but it is a bit off and I cannot really understand, why.
csillag= "*" * len(word)
text = text.split()
for i in text: if i==word: i=csillag return i text=" ".join(text) return text
Your function fails on censor("hey hey hey","hey").
It returns "" when it should return " *** ***".
(I could not paste it right, but it returns 1 "***" instead of 3)
If I remove the "return i" part, it does nothing. I have not really get why the for loop does not go through the whole text.
Thanks for your help!
Replace this line with your code.