please can anyone help me to understand this code by simple way ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

please can anyone help me to understand this code by simple way ?

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

24th Jan 2019, 11:34 AM
Abdulrahman Awad
Abdulrahman Awad - avatar
3 Answers
+ 2
This is very simple and here you go: words is a list and using while loop you are iterating that list and printing one value at a time. That's it.
24th Jan 2019, 11:47 AM
Ashok Kumar
Ashok Kumar - avatar
0
thank so much
24th Jan 2019, 12:09 PM
Abdulrahman Awad
Abdulrahman Awad - avatar
0
😂😂 you stuck where was I , when i started.. i suggest you to write this on paper then consider the every word, you will then understand it more easily..
24th Jan 2019, 3:06 PM
Aakash Gupta
Aakash Gupta - avatar