def pascal(line, element):
if not isinstance(element, int):
print "E = " , element , " : Please input an Integer"
return
if element <= 0:
print "E = " , element , " : Please input an Integer greater than 0"
return
if line < element:
print "Element must less than line"
return
if (line == 1) or (element == 1) or (line == element):
return 1
else:
return pascal(line-1, element-1) + pascal(line-1, element)
def pascaltri(n):
if not isinstance(n, int):
print "N = " , n , " : Please input an Integer"
return
if n <= 0:
print "N = " , n , " : Please input an Integer greater than 0"
return
i = 1;
while i <= n:
for j in range(0, n-i):
print "",
for j in range(1, i+1):
print pascal(i, j),
i = i+1
print "\n"