I want to print a list, for instance:
x = [ [1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[10, 11, 12]]
in a certain pattern like below:
1 2 3
4 5 6
7 8 9
10 11 12
but I couldn't figure it out.
In Java, I know that a simple nested for loop can do the job but not in Python. This is what I tried in Python:
for i in range(0, 4):
for j in range(0, 3):
print(x[i][j])
But the above code just prints each number in a new line.