Python pow() function
Raise a number to a power (the same as **).
Syntax
pow(base, exp, mod=None)
With a third argument it computes the remainder efficiently, which is used in cryptography.
Parameters
| base | the number |
| exp | the power |
| mod | optional: return the result modulo this |
Return value
a number
Example
Code
print(pow(2, 10), 2 ** 10) print(pow(9, 0.5)) print(pow(3, 4, 5)) # (3 ** 4) % 5
Output
1024 1024 3.0 1
Related
Learn it step by step in the free lesson Values, Variables & Numbers, with exercises that check your answers.