So, in “censor,” the tip is to use
" ".join(list) , however, not only do I not remember how these work, but I can’t seem to find them when I go through the previous lessons, so, if you can inform me which lessons they are discussed in, that would be greatly appreciated.
Also, because I’m pretty stubborn, I tried to code it without those functions, but it seems to have some problems.
def censor(text,word): a=len(word) result="" z=0 for char in text: if z>0: z-=1 elif char==word: b=word.index(char) if text[b:b+a]==word: [details="Summary"] This text will be hidden [/details] result+="*"*a z=a-1 #else: # result+=char else: result+=char return result
Nevermind the problems, I found out what was wrong. I really stupidly took the index of the character in the word, instead of in the phrase, and since almost all the phrase just so happened to start with the word to be censored, it always gave a positive. I still haven’t found the lesson where they discuss those functions, however, so that would still be appreciated.