MCPcopy Create free account
hub / github.com/geekcomputers/Python / pascal_triangle

Function pascal_triangle

Binary Coefficients.py:1–15  ·  view source on GitHub ↗
(lineNumber)

Source from the content-addressed store, hash-verified

1def pascal_triangle(lineNumber):
2 list1 = list()
3 list1.append([1])
4 i = 1
5 while i <= lineNumber:
6 j = 1
7 l = []
8 l.append(1)
9 while j < i:
10 l.append(list1[i - 1][j] + list1[i - 1][j - 1])
11 j = j + 1
12 l.append(1)
13 list1.append(l)
14 i = i + 1
15 return list1
16
17
18def binomial_coef(n, k):

Callers 1

binomial_coefFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected