ScanSkill

pow

This pow() function returns a number raised to the power or modulus of the number raised to the power and another number.

Syntax

abs(base, exponent, number)

Here,

  • integer: Required. A number, the base.
  • exponent: Required. A number. the exponent.
  • number: Optional. A number, the modulus

Note: If the number is a complex number, its magnitude is returned. If the number is an integer with a base other than 10 the abs() function will return its value as a decimal integer.

Example

  • Base and exponent only — Integer
>>> pow(2, 2)
4
>>> pow(2, -2)
0.25
  • Base and exponent only — Float
>>> pow(2.0, -2.0)
0.25
>>> pow(2.0, 1.0/2.0)
1.4142135623730951
  • Integer, exponent, and number all three
>>> pow(10, 2, 9)
1 #equivalent to remainder of (10**10)/9