Python Tutorial Python Advanced Python References Python Libraries

Python math - exp() Function



The Python math.exp() function returns e raised to the power of specified number, i.e., ex. Please note that e is the base of the natural system of logarithms, and its value is approximately 2.718282.

Syntax

math.exp(x)   

Parameters

x Required. Specify the exponent of e.

Return Value

Returns e raised to the power of specified number.

Example:

In the example below, exp() function is used to calculate e raised to the power of specified number.

import math

print(math.exp(2))
print(math.exp(-2))
print(math.exp(1.5))
print(math.exp(-1.5))

The output of the above code will be:

7.38905609893065
0.1353352832366127
4.4816890703380645
0.22313016014842982

❮ Python Math Module