0
What is counter in python3
5 Respuestas
+ 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.
0
What's that ? And where did you read it ? Post the link of the resource.
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
0
I want meaning of counter in that coding
0
Thank you