I have a list of 2D elements
m = [[1,2,3,4,5],[6,7,8,9,10],[11,12,13,14,15],[16,17,18,19,20]]
and I want my output to be:
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18
19 20
I tried this loop:
for i in range(3):
for k in range(i,len(m),3):
print(*m[i][k:k+3],sep='\t')
but it prints
1 2 3
4 5
6 7 8
9 10
11 12 13
14 15
16 17 18
and gives me an error
I'm not sure if it is possible since it is going on the next element. Can anyone help me on this?