I have the following as my code. For me this delivers " Quoth the ***** " (with out the quotations) to the console.
I'm guessing the loop is terminating when the if statement returns false and the else statement is executed but i can't work out how to change it so it continues to the rest of the list after. I've tried a few variants of this code and currently seeing if i can use a 'while' loop to make it work but this is the closest output to the one I need.
any ideas? i'm asking because i looked at the code some other users produced the outcome with and it looks nothing like mine so i'm not even sure i'm using the right method.
def censor(text,word): indiv_words = text.split() result =  for x in indiv_words: if x.lower() != word: result.append(x) else: x = '*' * len(word) result.append(x) print ' '.join(result) return ' '.join(result) censor('Quoth the Raven Nevermore', 'raven')