Python Number Exp() Method



The exp() method in Python number is one of the Python Math functions that return the exponential of x: ex. Basically, it is used for calculating the power of E, and E here is called Euler’s number which is a mathematical constant and approximately equal to 2.71828. The exp() method in Python number helps the users in calculating the exponential value along with the base set toe. The input value for this function is the exponent value.


Following is the syntax for exp() method:

import math

math.exp( x )

Note - This function is not accessible directly, so we need to import the math module, and then we need to call this function using a math static object.


  • x - This is a numeric expression.

Return Value

This method returns exponential of x: ex.


The following example shows the usage of exp() method.

import math   # This will import math module

print "math.exp(-45.17) : ", math.exp(-45.17)
print "math.exp(100.12) : ", math.exp(100.12)
print "math.exp(100.72) : ", math.exp(100.72)
print "math.exp(119L) : ", math.exp(119L)
print "math.exp(math.pi) : ", math.exp(math.pi)

When we run the above program, it produces the following result:

math.exp(-45.17) :  2.41500621326e-20
math.exp(100.12) :  3.03084361407e+43
math.exp(100.72) :  5.52255713025e+43
math.exp(119L) :  4.7978133273e+51
math.exp(math.pi) :  23.1406926328

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.