A collection of implementations of common algorithms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
259 B

#! /usr/bin/env python3
7 years ago
# find the rows of pascal's triangle
def choose(n, k):
if k == 0:
return 1
return choose(n, k-1) * (n-k) / k
def pascal(n):
return [choose(n, i) for i in range(0, n)]
7 years ago
for i in range(1, 11):
print(pascal(i))