Https://www.codecademy.com/courses/learn-python/lessons/practice-makes-perfect/exercises/censor-

https://www.codecademy.com/courses/learn-python/lessons/practice-makes-perfect/exercises/censor-


I don’t understand this part of the code,
1.the result variable is empty so in the console how does the text appear which is not asterixed
2.Why does the words have tobe counted and made equal to stars,doesn’t starts variable take care of the number of asterix required

the result variable is totally redundant. we can just return the joined result

What you describe is not what is happening in reality. the count variable is used to determine which element we want to update in the list. here:

words[count] = starts

updates element in the words list at index count (whatever the current value is count is). = is assignment operator.

1 Like

Dear stetim,

Sorry for the late response
1.the list that you are talking about is what,l didn’t quite get it,is it the stars variable you are talking about?
2.So you are saying
words[count] = stars
is locating the index of the words to perform the function?
3. what is the purpose of having the count variable

Thank you
Jagmeet

no, its words. split will split a string into a list

count is to keep track of which index/position of the words list you are currently you are, so you can update this element for censoring.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.