+ 1

words = ["hello", "world", "spam", "eggs"] for word in words: print(word + "!")

I don't understand that .. what the value (purpose)of "word"in that program..

10th Mar 2018, 2:16 PM
Hari Susanth K S
4 Answers
+ 7
word is a placeholder of sorts. The for loop iterates over the list and for each iteration word takes the value of the next item. For the first iteration word is "hello" for the second word is "world" and so on down to the last iteration where word is "eggs". NOTE: It is not mandatory to use word, you can use another name like "item"
10th Mar 2018, 2:21 PM
David Akhihiero
David Akhihiero - avatar
+ 5
It is foreach loop. It is saying thing like: For every word in words array, print word to the screen. Word is each word in words array.
10th Mar 2018, 2:19 PM
Sad
Sad - avatar
+ 2
Tq friends
10th Mar 2018, 2:25 PM
Hari Susanth K S
0
DM your answer's
10th Mar 2018, 2:17 PM
Hari Susanth K S