GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Python-1/maths/binomial_coefficient.py at master · https-github-com-nzysoft/Python-1 Expand file tree/ Copy pathbinomial_coefficient.pyMore file actions 20 lines (17 loc) · 438 Bytes / Copy pathbinomial_coefficient.pyFile metadata and controls20 lines (17 loc) · 438 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 def binomial_coefficient(n, r): """ Find binomial coefficient using pascals triangle. >>> binomial_coefficient(10, 5) 252 """ c = [0 for i in range(r + 1)] # nc0 = 1 c[0] = 1 for i in range(1, n + 1): # to compute current row from previous row. j = min(i, r) while j > 0: c[j] += c[j - 1] j -= 1 return c[r] print(binomial_coefficient(n=10, r=5)) |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |