For loop - Understanding what happens inside the loop,Python-3.x -


i have question, read online still not understood.

i have next loop , know how works in detail.

matrix = [[]] counter = 0 row = 5 col = 3 matrix = [[counter in range(row)] j in range(col)]  row in matrix:     elem in row:         print(elem, end=' ') print() 

this first line in loop>>> "for row in matrix:" >>> talking how many row have second line >>> "for elem in row:" talking how many elements in row use of variable "col"?

i understand how loop works in java or c++, here not understand completely, happy explain

thank you.

in second loop iterate on elements in row excatly iterate on columns.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -