def generate(numRows):
pascal = [[1]*(i+1) for i in range(numRows)]
for i in range(numRows):
for j in range(1,i):
pascal[i][j] = pascal[i-1][j-1] + pascal[i-1][j]
return pascal
for the second line of the code, there is a for loop statement inside the list initialization, what's the difference between that and
for i in range(numRows):
pascal = [[1]*(i+1)]
I know for the second one, pascal will be overwriting every loop, but if I'd like to have the same result as the original one, how should I change the code?