On the practice functions


def censor(text, word):
words = text.split()
result = ‘’
stars = ‘*’ * len(word)
count = 0
for i in words:
if i == word:
words[count] = stars
count += 1
result =’ '.join(words)

return result

print censor(“this hack is wack hack”, “hack”)

can someone tell me what "words[count] = stars " does in the code


count is a running value that starts at zero and grows by 1 with each new word being iterated.


is the word at the index, count, which is then replaced with a string of stars of the same length.

words[count] = stars