PyDocs

Nav

Python Runtime Services

pow

builtins

function
  • pow(base, exp, mod=None)
Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments

Some types, such as ints, are able to use a more efficient algorithm
when invoked using the three argument form.
Changed in 3.8
  • 3.8: For int operands, the three-argument form of pow now allows the second argument to be negative, permitting computation of modular inverses.
  • 3.8: Allow keyword arguments. Formerly, only positional arguments were supported.
1 Example
>>> pow(38, -1, mod=97)
23
>>> 23 * 38 % 97 == 1
True
from the Python docs
See Also
No see-alsos for builtins/pow
0 Notes
No notes for pow