pow(base, exp, mod=None)
Returns the result of raising a number to a power, with optional modular division.
Parameters
The pow() function accepts three parameters:
base- the base value to be raised to a powerexp- the exponent valuemod- (optional) divides the result ofbaseraised toexpand finds the remainder:base**exp % mod
Arguments of numeric types are expected. If operands of different types are passed, type conversion occurs according to binary arithmetic rules. Using only the first two arguments, pow(base, exp), is equivalent to using the exponentiation operator: base ** exp. The three-argument form is used for modular exponentiation.
Return Value
The pow() function returns:
base**exp- when no modulus is providedbase**exp % mod- when the modulus argument is provided1- if the exponent is00- if the base is0
Examples
pow(2, 3) # 8
pow(10, 2) # 100
pow(10, -2) # 0.01
pow(2, 3, 10) # 8