Variable a won't print when I run the code. Why?
I also don't understand why the written code won't append all words to wordlist and replace them with astericks as intended. I get a shorter output: ['hey', 'hey'] instead of "*** *** ***".
def censor(text,word): a=0 variable=text wordlist= wordstring='' for c in variable: a+=1 if c.isspace()==False: wordstring+=c else: wordlist.append(wordstring) wordstring='' for obj in wordlist: if obj==word: for c in obj: c='*' print a return wordlist