For the purpose of keeping to this short, Ill excluse the entire code, this is more of a pythonic question. Lets pretend that theres a list called "plist". This list has a rage of N...
print(plist[0:4])
print(plist[4:8])
print(plist[8:12])
print(plist[12:16])
print(plist[16:20])
print(plist[20:24])
...
What Im trying to do is imitate this behavior, basically printing out my list into 4 columns... simple enough right?
also, its a straight up list,nothing nested Using the len() we can get the number to use for range Im just im banging my head trying to figure out how to use a loop that will use the len() as the max value ...??
Also, I know you can use slice but there's some logic math involved since the length can be od or even and bahhhh.... my brain hurt.
EXAMPLE OF OUTPUT:
>>> plist
[178433, 207110, 204805, 140038, 177544, 179979, 166668, 177602, 140559, 170642, 208019, 150809, 161434, 177565, 134814, 175221, 172577, 204708, 177573, 146604, 177694, 180041, 156088, 180064, 172478, 177599, 172608, 141761, 156226, 171718, 170056, 141513, 208082, 162509, 171726, 132431, 204753, 178386, 179923, 178390, 171864, 204772, 207049, 134368, 148961, 169828, 131301, 171754, 144107, 206308, 178415, 151920, 206323, 207988, 134334, 141431, 206328, 176508]
And desired output
forExmple()
[178433, 207110, 204805, 140038]
[177544, 179979, 166668, 177602]
[140559, 170642, 208019, 150809]
[161434, 177565, 134814, 175221]
[172577, 204708, 177573, 146604]
[177694, 180041, 156088, 180064]
UPDATE
AHA! okay so I figured if I break the list it more list ... durppp Ican chuck it... quick google search.... so I got this..
chunks = [plist[x:x+4] for x in range(0, len(plist))]
THEN, By using lenght of chuncks I can iterate throughthat number as therange,,,
for i in range(0, len(chunks)):
print(chunks[i])
BOOM... any better way?