+ 3
words=["o","my","god"] i=0 index=len(words)-1 for word in words: if i<=index: print(words[i])
If we change words with word in print statement ,the difference between the two codes
1 Réponse
+ 6
"for word in words", indicates that words is a list and since you decided to go with var "word" , word is iterated as o , my , god. (basically assigning o , my , god to word as the loop proceeds)
So if you want to print word[i], the output will be the 1st letter of word, since i=0.
Output:
o
m
g
You can use the code playground for better understanding.. play around with the variables a little bit.