k
items from n
items without repetition and without order.math.comb()
to calculate the binomial coefficient.from math import comb
def binomial_coefficient(n, k):
return comb(n, k)
binomial_coefficient(8, 2) # 28
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️