Pow Function - Python Math Module

method name:

pow(aNumber_in, aPower_in)

method overview:

The pow() method returns the number raised to the power specified.

parameters:

aNumber_in  - The number which is to be raised to the specified power
aPower_in   - Specifies how many times aNumber_in has to be multiplied by itself.

Return value:

The aNumber_in multiplied by aPower_in times by itself.

Example:

import math

#Find 2 raised to the power 5

TwoPowerFive = math.pow(2,5)

print("Value of 2 raised to the power 5 is: {}".format(TwoPowerFive))

 

#Find speed of the light - that is approximately 3*pow(10*8)

SpeedOfLight = 3*math.pow(10,8)

print("Speed of light is approximately:{}".format(SpeedOfLight))

Output:

Value of 2 raised to the power 5 is: 32.0

Speed of light is approximately:300000000.0 meters per second


Copyright 2024 © pythontic.com