- 4

Fill in the blanks to iterate over the list using a far loop and print it's values. list=[1,2,3] , _ var_list: , print(_)

2nd Jul 2017, 2:31 PM
Ayoola-popoola Samuel
2 Réponses
+ 2
list = [1, 2, 3] for var in list: print(var)
1st Apr 2020, 11:28 AM
jhonvidelis
jhonvidelis - avatar
+ 1
I see you changed your question, so I shall now intervene. This looks like a challenge question or something from sololearn. list = [1, 2, 3] for var in list: print(var) The var simply is a variable that will be used when it shifts through each number inside the list. So the first time it loops, var becomes 1, then 2, and then 3. The best way to look at a for loop, is to say: For each value in the list If you're ever stuck on any of those tutorial questions, just go back and reread the examples, it doesn't penalize you. We can surely help and have no problem doing so, but be sure to practice, otherwise you won't be able to properly do it yourself. ^^
2nd Jul 2017, 2:58 PM
Sapphire