Home >>Python math Module >Python math.perm() Method

Python math.perm() Method

Python math.perm() Method

Python math.perm() method is used to return the number of ways to choose k items from n items with order and without repetition. The k parameter is an optional parameter.

Syntax:
math.perm(n, k)

Parameter Values

Parameter Description
n This is a required parameter. It defines a positive integers of items to choose from.
k This is an optional parameter. It defines a positive integers of items to choose.
Here is an example of Python math.perm() method:

import math
n = 7
k = 5
print (math.perm(n, k))

Output:
2520