Lesson 15, Exercise 10
I'm trying to understand code quality and best practices through these exercises. Below is my solution below, which works-- is there anything others would reccommend for this solution to be more efficient or better (naming, etc.)? I'd love to see other solutions and alternatives as well if others are willing to post. Thanks!
def censor(text, word): text = text.split() for x in range(len(text)): if text[x] == word: text[x] = "*" * len(word) censoredText = ' '.join(text) return censoredText