+ 1
How the program on for loop page is working
for word in words print(word +"!")
2 Answers
0
It prints every String of a String array and when they have no whitespace before they will be printed without
0
for word in words:
print(word + "!")
'words' is a list and 'word' takes the place of each item in the list in turn.
A list of ["spam","eggs","foo","bar"]
On the first iteration 'word' takes the first element of the list, in this case its "spam". It then prints it whilst concatenating "!" To the end. Then its the second iteration and 'word' takes "eggs" etc etc until there are no elements left in the list to loop through



