+ 3

I do not understand Question 6

filling in the blank: list [1,2,3,4,5] for var in list: print(var). Where this var came from?

23rd Feb 2020, 7:51 PM
Paulo Cesar Camargo
Paulo Cesar Camargo - avatar
4 ответов
+ 5
var is name of variable which will store the element of your list. Like when your for loop will run for first time than in var 1 will get stored and printed than loop will get executed second time than in var 2 will get stored and printed. This continues till the all elements in your list are printed. Var is a name of variable here. Hope you got it.
23rd Feb 2020, 8:01 PM
Nitin Tiwari
Nitin Tiwari - avatar
+ 1
Thanks. I understand. It comes at that point itself.
23rd Feb 2020, 10:33 PM
Paulo Cesar Camargo
Paulo Cesar Camargo - avatar
+ 1
Also var is not a reserved word in Python like in some other languages and can be used as a variable name.
24th Feb 2020, 1:35 AM
Sonic
Sonic - avatar