Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: utf-8
- # Programação 1, 2014.1 Pedro Paulo
- # Triângulo de Pascal
- indice = int(raw_input())
- if indice == 1:
- print 1
- print 1
- if indice == 2:
- print 1
- print 1, 1
- print 1
- print 2
- if indice > 2:
- print 1
- linha = [1, 1]
- for vert in range (indice-1):
- novalinha = [1]
- for horiz in range (vert):
- novalinha.append(linha[horiz + 1] + linha[horiz])
- novalinha.append(1)
- linha = novalinha
- saida = ""
- for x in range (len(linha)):
- saida = saida + str(linha[x])
- if x < (len(linha) - 1):
- saida = saida + " "
- print saida
- for i in range (indice):
- print 2**i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement