Skip to content

Home

Binomial coefficient

Calculates the number of ways to choose k items from n items without repetition and without order.

from math import comb

def binomial_coefficient(n, k):
  return comb(n, k)

binomial_coefficient(8, 2) # 28

More like this

Start typing a keyphrase to see matching snippets.