Math Functions

math.factorial()

Multiply the integers from 1 through n; zero has factorial 1. Requires a nonnegative integer.

Formal Syntax & Structure

python syntaxpython
math.factorial(n, /)

Parameters & Attributes

NameTypeDescription
nintNonnegative integer input.

Return Value

int

Integer result, exact for integer arithmetic.

Working Example

Example Snippetpython
import mathprint(math.factorial(6))
Python Reference