What is the logic behind (for word in words:)?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the logic behind (for word in words:)??

19th Jan 2017, 9:27 PM
Diab
3 Answers
+ 2
words is a list, and the syntax for word in words: will execute the loop code for every value of words (they will be stored one after the other in word) example : words=["Hello","world"] for word in words: print(word) output : Hello world
19th Jan 2017, 9:40 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
thank you very much ☺
19th Jan 2017, 9:42 PM
Diab
+ 1
my pleasure :)
19th Jan 2017, 9:43 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar