Replace elements of an array with an "X"

0

I have code that should print an array according to the input.

You should print the matrix by having the "X" form a spiral right from the middle, does anyone have any ideas?

ps.:The code comments are the 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
    
asked by anonymous 09.06.2017 / 14:29

0 answers