My code is printing spaces at the beginning and end of the line, and it is giving presentation error (question 1557 URI) Does anyone have a good tip? "The values of the arrays must be formatted in a field of T size justified to the right and separated by space"
matriz = []
while True:
tamanho = int(input())
valor = 1
if tamanho == 0:
break
for i in range(tamanho):
linha = []
for j in range(tamanho):
linha.append(valor)
valor = valor*2
if len(linha)==tamanho:
valor = linha[0]
valor = valor*2
matriz.append(linha)
tamanho_caracter=(str(matriz[-1][-1]))
tamanho_caracter=len(tamanho_caracter)
aux=tamanho_caracter+1
for a in matriz:
for b in a:
convert1=str(b)
print("{}".format(convert1).rjust(aux),end="".strip())
print()
print()
matriz = []