Write a matrix without numpy o Python

I am trying to get my code to display a better looking matrix, but I just can’t fix it.

My code so far is:

n = int(input("Digite o número de variáveis do sistema: "))
matriz_A=[]
for i in range(n):
   b=[]
   for j in range(n):
      j=float(input("Digite a entrada ["+str(i+1)+"]["+str(j+1)+"]"))
      b.append(j)
   matriz_A.append(b)
for i in  range(n):
   for j in range(n):
      print(matriz_A[i][j],end=" ")
   print()

But it’s only displaying the numbers next to each other.

How can I solve this ? Thank you !

Answer

You can add print('[') before the loop i and before the loop j, and likewise for the ].

matriz_A = [[1,2], [3,4]]
n = 2

print('[', end="")
for i in  range(n):
   if i > 0:
      print(' '*(n-1), end="")
   print('[', end=" ")
   for j in range(n):
      print(matriz_A[i][j],end=" ")
   print(']', end="")
   if i != n-1:
      print()
print(']')

Output:

[[ 1 2 ]
 [ 3 4 ]]