from operator import mul
from fractions import Fraction
from functools import reduce

def nCk(n, k):
    return int(reduce(mul, (Fraction(n - i, i + 1) for i in range(k)), 1))
Statistics: combinations in Python