rows = range(1, 3) # range(1, 3)--> 1, 2 cols = range(1, 4) # range(1, 4) --> 1, 2, 3 for row in rows: for col in cols: print(row, col) # --- > 1 1 1 2 1 3 2 1 2 2 2 3 It is not clear here, why in the second column 1, 2? We take that row row index, col column index, range(1, 3) range (1, 4) - number of rows and columns.
0 pass: temporary variable row takes from rows (1, 2) - 1, then 0 iteration col takes temporary variable from cols (1, 2, 3) - 1.
1 pass: temporary variable row takes from rows (1, 2) - 2?
And why in the end 6 columns? If you take each cycle of them separately, 5 is obtained, if only the 6th is 0 pass (iteration).
And another question is if i (nothing is assigned to the temporary variable before the loop), by default it always starts with 0 and starts iterating?