#!/usr/bin/env python#-*- coding: utf-8 -*-
deftriangles():
n= 1aboveList=[]whileTrue:if n == 1:
aboveList= [1]
n= n + 1
yield [1]if n == 2:
aboveList= [1,1]
n= n + 1
yield [1,1]
newList=[]for x ingetMiddleList(aboveList):
newList.append(x)
newList.insert(0,1)
newList.append(1)
aboveList=newList
n= n + 1
yieldnewListreturn 'done'
defgetMiddleList(aboveList):
newList=[]
leftNodeVal=0
n=1
for x inaboveList:if n == 1:
leftNodeVal=xelse:
newList.append(x+leftNodeVal)
leftNodeVal=x
n+= 1
returnnewList
n=0for t intriangles():print(t)
n= n + 1
if n == 10:break