I have an array of 200 items.
grid = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 .... and so on]
How can I print it as a 2D array like so? Split it every 10 characters actually.
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
I have tried things such as
def Print(grid):
for i in grid:
if(len(i) % WIDTH-1 == 0):
print(i)
else:
print(i, end = ' ')
with no success.