Print a list in a square pattern in python

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 wasn’t able to figure it out.

In Java, I know that a simple nested for-loop can do the job but that’s not happening in Python. I tried to learn python from python programming tutorial:

for i in range(0, 4):

for j in range(0, 3):

    print(x[i][j])

But the above code is just printing each number in a new line.

Edit your question to improve it. You tagged math. Do you mean you want to craft a math formula with the Math editor?

Basically, the code is left [ matrix { left [ 1 2 3 right ] ## left [ 4 5 6 right ] } right ]

it seems your in wrong forum, but anyway:

 x = [ [1, 2, 3],
       [4, 5, 6],
       [7, 8, 9],
       [10, 11, 12]]

 for elem in x:
     print(', '.join(f'{y}' for y in elem))

Thanks for the help