So I have a list that looks like this:
list_1 = [[1, 2, 3, 4,],
[5, 6, 7, 8],
[9, 10, 11, 12]]
What I want to do is traverse through it like a snake, so the output is:
1,2,3,4,8,12,11,10,9,5,6,7 (if you visualize that against the original list hopefully you'll see what I mean.
I have this, which somewhat works though the output is choppy:
print(list_1[0], list_1[1][-1], list_1[2][-1], list_1[2][-2::-1], list_1[1][0:3])
What I want to do is come up with something that's more sustainable/generic, in case the length of each list gets longer (or shorter) or the number of sub-lists grows etc...
I think I need some kind of loop to do this, but not sure how to go about doing it...