math.e
The number e, the base of the natural logarithm.
Python 3.13
math.eReturn value
The float 2.718281828459045.
Examples
The value of e
Python 3.13
import math
print(math.e)2.718281828459045
The limit of (1 + 1/n) to the power n
Python 3.13
import math
n = 1_000_000
print(round((1 + 1 / n) ** n, 5), round(math.e, 5))2.71828 2.71828
Details
It is a constant, not a function: write it without parentheses. For a power of e, math.exp(x) is better: it does the same as math.e ** x, but more accurately. The natural logarithm math.log(x) uses base e.
