math.perm

Full name
math.perm
Library
math
Syntax

math.perm(n, k = None)

Description

The math.perm function returns the number of permutations without repetition of n elements grouped in blocks of k elements.

If the parameter k is not specified or if it takes the value None, k defaults to n and the function returns n!.

Parameters
  • n: Integer representing the number of elements to group.
  • k: Integer representing the size of the groups.
Result

The result of math.perm is an integer.

Examples

We can obtain the number of possible permutations of 6 elements grouped in blocks of 3 with the following code:

math.perm(6, 3)

120

Submitted by admin on Mon, 01/25/2021 - 14:12