import random as r
 
def triangleDePascal(n):
   if(n==0):
       return []
   if(n==1):
       return [[1]]
   triangle=[[1],[1, 1]]
   columns=n
   for line in range(2,n):
       triangle.append([1])
       for column in range(1, line):
           triangle[line].append(triangle[line - 1][column - 1] + triangle[line - 1][column])
       triangle[line].append(1)
   return triangle
      
#t=triangle(8)
#for line in range(0,7):
#   print(t[line])
 
def estTriangleDePascal(n):
   if(n==0):
       return []
   if(n==1):
       return [[1]]
   triangle=[[1],[1, 1]]
   columns=n
   for line in range(2,n):
       triangle.append([1])
       for column in range(1, line):
           triangle[line].append(triangle[line - 1][column - 1] + triangle[line - 1][column])
       triangle[line].append(1)
   return triangle
 
def testTriangleDePascal(n):
   listTest=[0,1]
   for i in range(0,n):
    listTest.append(r.randint(5,140))
   for i in listTest:
       if(triangleDePascal(i)!=estTriangleDePascal(i)):
           return False
   return True