pow

pow(base, exp, mod=None)

Returns base to the power of exponent (built-in, numpy).

basenumber which is to be powered
expnumber which is to be powered with x
mod(Optional) number which is to be used for modulus operation

REMARKS
* This is a built-in function.
* Return base to the power exp; if mod is present, return base to the power exp, modulo mod (computed more efficiently than pow(base, exp) % mod). The two-argument form pow(base, exp) is equivalent to using the power operator: base**exp.
* The arguments must have numeric types. With mixed operand types, the coercion rules for binary arithmetic operators apply. For int operands, the result has the same type as the operands (after coercion) unless the second argument is negative; in that case, all arguments are converted to float and a float result is delivered. For example, pow(10, 2) returns 100, but pow(10, -2) returns 0.01. For a negative base of type int or float and a non-integral exponent, a complex result is delivered. For example, pow(-9, 0.5) returns a value close to 3j.
* For int operands base and exp, if mod is present, mod must also be of integer type and mod must be nonzero. If mod is present and exp is negative, base must be relatively prime to mod. In that case, pow(inv_base, -exp, mod) is returned, where inv_base is an inverse to base modulo mod.
* For the Official documentation refer to python.org

import numpy as np 

pow(38, -1, mod=97) #= 23

23 * 38 % 97 == 1 #= True

© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited Top