Traceback (most recent call last):
File “python”, line 7, in < module>
File “python”, line 6, in censor
AttributeError: ‘list’ object has no attribute ‘join’
This is obviously not the right way to do it, but I am a bit stuck. I don’t know why my .split on line 2 doesn’t count as an attribute to join. I am trying to get “word” to be censored which in this case is “time”. I may have misunderstood the assignment though.
def censor(text, word): words = word.split() for i in range(len(words)): if words[i] in word: words[i] = "*" * len(words[i]) text = words.join() print censor("snack", "time")