LearnPy Hub
← Comprehensions problems
Hard

Pascal's Triangle

Read n and print the first n rows of Pascal's triangle. Build each row from the previous one with a comprehension: [1] + [r[i] + r[i + 1] for i in range(len(r) - 1)] + [1].

Input

One integer n ≥ 1.

Output

n lines.

Sample 1

Input
5
Output
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1

Sample 2

Input
1
Output
1
solution.py
Output appears here
Pascal's Triangle · Python practice problem · LearnPy Hub