progamma error

Asked

Viewed 89 times

-4

def trianguloPascal(n):
    lista = [[1],[1,1]]
    for i in range(1,n):
        linha = [1]
        for j in range(0,len(lista[i])-1):
            linha += [ lista[i][j] + lista[i][j+1] ]
        linha += [1]
        lista += [linha]
    return lista

n = input("Digite o número de linhas para o triângulo de Pascal: ")
resultado = trianguloPascal(n)

for i in range(len(resultado)):
    print(resultado[i])
  • 2

    Please click [Edit] above, select all the code and click the button {} from the editor to format correctly. And please explain what is the problem of the code and what is your question.

  • 1

    John, always add a headline that adds content to your question and describe your problem in detail in the scope of the post, so it’s easier to get help

1 answer

0


Browser other questions tagged

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