0

What is counter in python3

25th Dec 2019, 4:37 AM
Shardul Malkhare
Shardul Malkhare - avatar
5 Answers
+ 1
Shardul Malkhare then your question was so unclear, try to give more details next time because it had no meaning before you posted this. counter is just a variable, used to tell us if we reached the end of the list or not. First it has a value of 0, then get increased inside the loop. I don't know how to explain any further, because it is very well explained in the course. Either you were confused because we used a different variable name, other than the usual i, which is bad. Or, you don't know how loops work, in which case you need to review the course again, because it explains it well, and there are many questions about it in here, so please use the searchbar.
25th Dec 2019, 4:50 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
What's that ? And where did you read it ? Post the link of the resource.
25th Dec 2019, 4:39 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
words = ["hello", "world", "spam", "eggs"] counter = 0 max_index = len(words) - 1 while counter <= max_index: word = words[counter] print(word + "!") counter = counter + 1
25th Dec 2019, 4:46 AM
Shardul Malkhare
Shardul Malkhare - avatar
0
I want meaning of counter in that coding
25th Dec 2019, 4:46 AM
Shardul Malkhare
Shardul Malkhare - avatar
0
Thank you
25th Dec 2019, 4:52 AM
Shardul Malkhare
Shardul Malkhare - avatar