```
class Solution(object):
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
lst = []
if numRows>0:
for m in range(numRows):
a = []
x = []
y = []
for n in range(m+1):
a.append(1)
x.append(1)
y.append(1)
for i in range(1,m+1):
for j in range(i):
x[i] = x[i]*(m-j)
y[i] = y[i]*(i-j)
a[i] = x[i]/y[i]
lst.append(a)
return lst
else:
return []
```