matriz = []
def create_matriz(a, b):
for contador in range(a):
matriz.append( [0] * b )
def print_matriz(txt):
cont = 0
for j in range(a):
for i in range(b):
if txt[cont] == "0":
matriz[i][j] = 0
elif txt[cont] == "1":
matriz[i][j] = 1
print txt[cont]
cont += 1
code = " #Aqui vai uma sequência de 441(21 x 21) algarismos zeros e uns/Não
coloquei porque da problema"
a = 21
b = 21
create_matriz(a, b)
print_matriz(code)
Next, I have this code to read a string with 441 digits, and place them inside an array of integers.
So long so good.
But at the time of printing, instead of printing as an array (without a line break), for each of the 441 figures, prints a new line.
How do I not break line and print a frame with dimensions of 21 x 21?
ex:
000000000000000000000
110111011111011111110
010101000100010100010
010101111111010101110
010100000101000101000
011101111101110101110
000001010100010100010
011111010111011101010
000000010001000001010
011111010111011111010
010100010000010101000
010111110111110101110
010000000100000000010
010111110101110111110
010101010101010100000
010101011101010111010
010101000001010001010
010101011111011111010
010001010000000000010
011111011111111111111
000000000000000000000