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(int(n))
for i in range(len(resultado)):
print(resultado[i])
ZGVmIHRyaWFuZ3Vsb1Bhc2NhbChuKToKICAgIGxpc3RhID0gW1sxXSxbMSwxXV0KICAgIGZvciBpIGluIHJhbmdlKDEsbik6CiAgICAgICAgbGluaGEgPSBbMV0KICAgICAgICBmb3IgaiBpbiByYW5nZSgwLGxlbihsaXN0YVtpXSktMSk6CiAgICAgICAgICAgIGxpbmhhICs9IFsgbGlzdGFbaV1bal0gKyBsaXN0YVtpXVtqKzFdIF0KICAgICAgICBsaW5oYSArPSBbMV0KICAgICAgICBsaXN0YSArPSBbbGluaGFdCiAgICByZXR1cm4gbGlzdGEKCm4gPSBpbnB1dCgiRGlnaXRlIG8gbsO6bWVybyBkZSBsaW5oYXMgcGFyYSBvIHRyacOibmd1bG8gZGUgUGFzY2FsOiAiKQpyZXN1bHRhZG8gPSB0cmlhbmd1bG9QYXNjYWwoaW50KG4pKQoKZm9yIGkgaW4gcmFuZ2UobGVuKHJlc3VsdGFkbykpOgogICAgcHJpbnQocmVzdWx0YWRvW2ldKQ==
Digite o número de linhas para o triângulo de Pascal: [1]
[1, 1]
[1, 2, 1]
[1, 3, 3, 1]
[1, 4, 6, 4, 1]
[1, 5, 10, 10, 5, 1]