0
I have code that should print a matrix according to the input.
You should print the matrix so that the "X" forms a right spiral starting from the middle, someone has some idea?
ps.:Code comments are attempts
while True:
tamanho = int(input())
if tamanho in range(1, 25):
tabela = []
for x in range(0, tamanho):
tabela.append(["O"]*tamanho)
for y in tabela:
print("".join(y))
'''tabela[(len(tabela)+1)/2] = "X"
posicao_do_x = len(tabela)/2
posicao_do_x2 = int(posicao_do_x) // int(y)
posicao_do_x3 = int(posicao_do_x) % int(y)
tabela[int(posicao_do_x2)][int(posicao_do_x3)] = "X"'''
print("@")
else:
break
Is there any way to draw an example of what the exit would look like? It’s a little hard to understand exactly what a "right spiral starting in the middle".
– Woss
Would be similar to that?
– Woss
You want to make a Ulam spiral?
– weltonvaz