["python","function","math"]
Is there a math nCr function in Python?

Is there a built-in nCr (n choose r) function included in the Python math library like the one shown below? I understand that the computation can be programmed, but I thought I'd check to see if it's built-in before I do.
On Python 3.8+, use math.comb: >>> from math import comb >>> comb(10, 3) 120 For older versions of Python, you can use the following program: 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