Python for Beginners

pow() Mathematical function in Python

Python for Beginners | python Tutorial



Overview

pow(a,b) mathematical function in python is used to calculate the value ab.

Syntax

The syntax of the pow() mathematical function is given below:

								
pow(a,b)
								
							

where a and b are numeric value passed as a parameter.
Please note that we need to import the math module in order to access the ceil() function as this function is not directly available.

Returns

This mathematical function returns the value of ab.

Examples


								
#name of the file: pow.py
#import the math module 
import math
#pow() on float value
print("math.pow(2.9,5) = ", math.pow(2.9,5))

#pow() on int value
print("math.pow(2,5) = ", math.pow(2,5))
								
							


We can run the above code using the following command:
								
>python pow.py
math.pow(2.9,5) =  205.11148999999997
math.pow(2,5) =  32.0