Python math.exp()

Anonymous contributor's avatar
Anonymous contributor
Published May 19, 2021Updated Mar 17, 2024
Contribute to Docs

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

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours

Syntax

math.exp(x)

e is approximately 2.718282.

Example

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

import math
print(math.exp(5))

The above code gives the following output:

148.4131591025766

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

import math
print(math.exp(3))

The above code gives the following output:

20.085536923187668

Codebyte Example

Run the following example that uses the math.exp() function to understand its working:

Code
Output

All contributors

Contribute to Docs

Learn Python on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours