Plz explain line number five (how counter is related to words )why in square brackets here , wht is the logic here ..? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Plz explain line number five (how counter is related to words )why in square brackets here , wht is the logic here ..?

words = ["hello", "world", "spam", "eggs"] counter = 0 max_index = len(words) - 1 while counter <= max_index: word = words[counter] print(word + "!") counter = counter + 1

7th Jan 2018, 12:13 PM
Bilal Asghar
Bilal Asghar - avatar
1 Answer