```
class Solution(object):
def generate(self, numRows):
if numRows <= 0:
return []
r = [[1]]
[r.append(
[(i > 0 and r[-1][i-1] or 0) + (i < len(r[-1]) and r[-1][i] or 0)
for i in xrange(len(r[-1]) + 1)])
for _ in xrange(1, numRows)]
return r
class Solution(object):
def generate(self, numRows):
return [[
math.factorial(row) / math.factorial(i) / math.factorial(row - i)
for i in xrange(row + 1)
] for row in xrange(numRows)]
```