Math Functions

math.perm()

Count ordered selections without repetition. With k omitted or None count all permutations; k greater than n gives zero.

Formal Syntax & Structure

python syntaxpython
math.perm(n, k=None, /)

Parameters & Attributes

NameTypeDescription
nintNonnegative integer input.
kint or NoneNumber of items to select; None means all items for perm.

Return Value

int

Integer result, exact for integer arithmetic.

Working Example

Example Snippetpython
import mathprint(math.perm(5, 2))
Python Reference