Python board writing problem: 'Typeerror: not all Arguments converted During string formatting'

Asked

Viewed 170 times

2

How can I fix this? There’s the code. `` looks like this:

[(((2,), (3,), (2,), (2, 2), (2,)), ((2,), (1, 2), (2,), (3,), (3,))), [['?', '?', '?', '?', '?'], ['?', '?', '?', '?', '?'], ['?', '?', '?', '?', '?'], ['?', '?', '?', '?', '?'], ['?', '?', '?', '?', '?']]]

The error is here: print ("[ %s ]" % t[i][c],Sep="n",end="")

Method:

def escreve_tabuleiro(t):

    n_linhas=len(tabuleiro_especificacoes(t)[0])
    lista_especificacoes=list(tabuleiro_especificacoes(t))

    maximo=max(map(len, lista_especificacoes[1]))
    minimo=[0]*(len(lista_especificacoes[1]))

    for h in range(maximo):
        for i in range(len(lista_especificacoes[1])):
            if maximo <= len(lista_especificacoes[1][i]):
                lista=list(lista_especificacoes[1][i])
                print("  %s  " % lista[minimo[i]],sep="",end="")
                minimo[i] +=1
            else:
                print("  %s  " % " ",sep="  ",end="")
        maximo=maximo-1
        print("  ")

    maximo=max(map(len,lista_especificacoes[0]))
    minimo=[0]*(len(lista_especificacoes[0]))

    for i in range(len(t)-1):
        for c in range(n_linhas+maximo):
            if c < n_linhas:
                print ("[ %s ]" % t[i][c],sep="\n",end="")
            else:
                if minimo[i] < len(lista_especificacoes[0][i]):
                    lista=list(lista_especificacoes[0][i])
                    print(' %s' % lista[minimo[i]],sep='',end='')
                    minimo[i] +=1
                else:
                    print(" %s" % " ", sep="",end="")
        print('|')

    print()

inserir a descrição da imagem aqui

  • It’s Python 2 or 3?

  • What I’m using is Python 3.5.0

  • Hello, John. Welcome. Please put stacktrace in your question so we know exactly where the problem is happening.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.