Jump to content

Evaluate binomial coefficients: Difference between revisions

→‎Functional Python: Added tests for k=0 to k=5 (where n = 5)
(→‎{{header|Python}}: Added a second (Python 3 compatible) functional version)
(→‎Functional Python: Added tests for k=0 to k=5 (where n = 5))
Line 1,926:
 
 
# TESTTESTS ---------------------------------------------------
print(
binomialCoefficient(5)(3)
)
 
# k=0 to k=5, where n=5
print(
list(map(
binomialCoefficient(5),
enumFromTo(0)(5)
))
)</lang>
{{Out}}
<pre>10
[1, 5, 10, 10, 5, 1]</pre>
 
=={{header|R}}==
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.