Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python n choose r

# PYTHON <3.8
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom  # or / in Python 2
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #choose
ADD COMMENT
Topic
Name
8+1 =