On this page
  1. math.comb
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

math.comb

Prev: math.ceil | Up: math | Next: math.copysign
Rel: math.acos, math.acosh, math.asin, math.asinh
Ref: docs.python.org — math.comb
Tags: #public #python3 #stdlib #math


Import

import math
from math import comb

Signature & Overview

math.comb(n, k, /)

Number of ways to choose k items from n items without repetition and without order.

Usage

import math

assert math.comb(5, 2) == 10
assert math.comb(5, 6) == 0

Gotchas

REPL Inspect

from math import comb
help(comb)

Linked from

Related notes