I am looking to divide a list into 3 parts in python. If the list doesn't divide by 3, I would like it to 'fill' the first column then the second, then the third.
e.g:
1|2|3
1|3|
2|
1|3|
2|4|
1|3|5
2|4|
1|3|5
2|4|6
And so on.
I am currently doing something like this, which doesn't give the desired results. Have also played around with using %
to no avail
l = [1,2,3,4,5]
a = [:l/3]
b = [l/3:(l/3)*2 ]
c = [(l/3)*2 :]
All help appreciated, thanks
Note The answer to Splitting a list of into N parts of approximately equal length gives the opposite result, so please don't mark this question as already answered