I have a list of numbers from range 1 to n and I want to split those numbers into x sublists where each sublist contains less than 30 numbers. The amount of sublists is the least amount i need depending on the total of numbers in a list so for example if I had 68 I'd need 3 sublists at least where the numbers are split between them. How would I go about splitting them so each sublist has the next number in the original list to get an output like this
a = []
for i in range(68):
a.append(i)
#code
output:
[[1,6,7,12,13,18,19,24....][2,5,8,11,14,17,20,23....][3,4,9,10,15,16,21,22....]]
or if I need 4 sub lists it'd go like this
output:
[[1,8,9,16,17....][2,7,10,15,18][3,6,11,14,19][4,5,12,13,20,21....]]
edit: this isn't the exact same question as Splitting a python list into 4 sub-lists that are as even as possible since I don't want the iteration to go back to the beginning once it finishes a loop. I want it to start iterating again from the bottom like this
[0,13,14,28,29,42,43,56,57]
[1,12,15,27,30,41,44,55,58]
[2,11,16,26,31,40,45,54,59]
[3,10,17,25,32,39,46,53,60]
[4,9,19,24,33,38,47,52,61]
[5,8,20,23,34,37,48,51,62]
[6,7,21,22,35,36,49,50,63,64]