math.exp()

The math.exp() method returns e raised to the power of a number.

Syntax

math.exp(x)

e is approximately 2.718282.

Example 1

Use math.exp() to return e raised to the power of 5:

import math
print(math.exp(5))
# Output: 148.4131591025766

Example 2

Use math.exp() to return e raised to the power of 3:

import math
print(math.exp(3))
# Output: 20.085536923187668

Codebyte Example

Edit this page on GitHub

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your feedback.

Learn Python on Codecademy

Edit this page on GitHub

Contributors