89DEVs

Python pow() function

overview of pow()

The pow() function returns the power of a base and its exponent. The most common use case is to calculate the square of an integer value.

use of pow()

The pow() function is used to calculate the power of a base and its exponent. # use of pow() num1 = pow(2, 2) num2 = pow(2, 3) num3 = pow(2, 4) print(num1) print(num2) print(num3) The pow() function is used to make the following calculations: 2 * 2 is 4 2 * 2 * 2 is 8 2 * 2 * 2 * 2 is 16 4 8 16

syntax of pow()

The syntax of the pow() function is: pow(x, y[, z])

arguments of pow()

The pow() function accepts 2 or 3 arguments. The first two arguments are the base and the exponent, which are required to use the pow() function. The third argument is optional and is used for modulus.
argument required description
base required the base
exponent required the exponent
modulus optional the number used for modulus

return value of pow()

The pow() function returns the power of the given number, either as an integer or float value.

                
        

Summary


Click to jump to section