ch11_r01.py 文件源码

python
阅读 45 收藏 0 点赞 0 评论 0

项目:Modern-Python-Cookbook 作者: PacktPublishing 项目源码 文件源码
def binom(n: int, k: int) -> int:
    '''Computes the binomial coefficient.
    This shows how many combinations of
    *n* things taken in groups of size *k*.

    :param n: size of the universe
    :param k: size of each subset

    :returns: the number of combinations

    >>> binom(52, 5)
    2598960
    >>> binom(52, 0)
    1
    >>> binom(52, 52)
    1
    '''
    return factorial(n) // (factorial(k) * factorial(n-k))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号