diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-06-02 08:16:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-02 08:16:49 (GMT) |
commit | 5ae299ac78abb628803ab7dee0997364547f5cc8 (patch) | |
tree | 243cb704ac7c8421e7406722912cc50e20b5ebad /Doc/library/math.rst | |
parent | d71f3170ac9c850f6d1f9bffaa628dc473df5e75 (diff) | |
download | cpython-5ae299ac78abb628803ab7dee0997364547f5cc8.zip cpython-5ae299ac78abb628803ab7dee0997364547f5cc8.tar.gz cpython-5ae299ac78abb628803ab7dee0997364547f5cc8.tar.bz2 |
bpo-37128: Add math.perm(). (GH-13731)
Diffstat (limited to 'Doc/library/math.rst')
-rw-r--r-- | Doc/library/math.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 8c68370..c5a77f1 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -207,6 +207,19 @@ Number-theoretic and representation functions of *x* and are floats. +.. function:: perm(n, k) + + Return the number of ways to choose *k* items from *n* items + without repetition and with order. + + It is mathematically equal to the expression ``n! / (n - k)!``. + + Raises :exc:`TypeError` if the arguments not integers. + Raises :exc:`ValueError` if the arguments are negative or if *k* > *n*. + + .. versionadded:: 3.8 + + .. function:: prod(iterable, *, start=1) Calculate the product of all the elements in the input *iterable*. |