+ 1

Why for loop function print list 3 times?

a= ["hello",77,99] for element in a : print (a) instead of printing element i print a and python printed that list 3 times .

16th May 2018, 4:23 PM
Gagan Deep Singh
Gagan Deep Singh - avatar
2 Answers
+ 3
a = [1,2,3] for var in a: print(var) #not print(a)
17th May 2018, 5:50 PM
Davod
Davod - avatar
+ 2
what about print(a) ,could you explain it bit more. glad you replied
16th May 2018, 4:28 PM
Gagan Deep Singh
Gagan Deep Singh - avatar