# Write a function solve that generates the first n rows of Pascal's Triangle. def solve(rows): triangle = [] for i in range(0, rows): row = [] row.append(1) if i == 1: row.append(1) elif i > 1: for j in range(0, i-1): first = triangle[i-1][j] second = triangle[i-1][j+1] row.append(first + second) row.append(1) triangle.append(row) return triangle