Home >>Python math Module >Python math.comb() Method
Python math.comb() Method in python is used to returns the number of ways picking k items from n items without repetition or order.
Syntax:math.comb(n, k)
Parameter | Description |
---|---|
n | It is required to choose items of positive integers |
k | It is required to choose positive integers of items |
import math
n = 7
k = 5
print (math.comb(n, k))
import math
n = 10
k = 2
nCk = math.comb(n, k)
print(nCk)
n = 5
k = 3
nCk = math.comb(n, k)
print(nCk)