Calculates the number of ways to choose k items from n items without repetition and without order.
- Use 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翻译自:https://www.30secondsofcode.org/python/s/binomial-coefficient
