Python math library | exp() method Last Updated : 07 Feb, 2023 Comments Improve Suggest changes 2 Likes Like Report Python has math library and has many functions regarding it. One such function is exp(). This method is used to calculate the power of e i.e. e^y or we can say exponential of y. The value of e is approximately equal to 2.71828….. Syntax : math.exp(y) Parameters : y [Required] - It is any valid python number either positive or negative. Note that if y has value other than number then its return error. Returns: Returns floating point number by calculating e^y. Time Complexity: O(1)Auxiliary Space: O(1) Code # 1: python3 # Python3 code to demonstrate # the working of exp() import math # initializing the value test_int = 4 test_neg_int = -3 test_float = 0.00 # checking exp() values # with different numbers print (math.exp(test_int)) print (math.exp(test_neg_int)) print (math.exp(test_float)) Output:54.598150033144236 0.049787068367863944 1.0 Code #2: python3 # Python3 code to demonstrate # the working of exp() import math # checking exp() values # with inbuilt numbers print (math.exp(math.pi)) print (math.exp(math.e)) Output:23.140692632779267 15.154262241479262 Code #3: TypeError python3 # Python3 code to demonstrate # the working of exp() import math # checking for string print (math.exp("25")) Output: Traceback (most recent call last): File "/home/c7ae4f1bef0ed8c7756b3f55e7d2ce81.py", line 6, in print (math.exp("25")) TypeError: a float is required Create Quiz Comment A AKASH GUPTA 6 Follow 2 Improve A AKASH GUPTA 6 Follow 2 Improve Article Tags : Python Python math-library Python math-library-functions Explore Python FundamentalsPython Introduction 2 min read Input and Output in Python 4 min read Python Variables 4 min read Python Operators 4 min read Python Keywords 2 min read Python Data Types 8 min read Conditional Statements in Python 3 min read Loops in Python - For, While and Nested Loops 5 min read Python Functions 5 min read Recursion in Python 4 min read Python Lambda Functions 5 min read Python Data StructuresPython String 5 min read Python Lists 4 min read Python Tuples 4 min read Python Dictionary 3 min read Python Sets 6 min read Python Arrays 7 min read List Comprehension in Python 4 min read Advanced PythonPython OOP Concepts 11 min read Python Exception Handling 5 min read File Handling in Python 4 min read Python Database Tutorial 4 min read Python MongoDB Tutorial 3 min read Python MySQL 9 min read Python Packages 10 min read Python Modules 3 min read Python DSA Libraries 15 min read List of Python GUI Library and Packages 3 min read Data Science with PythonNumPy Tutorial - Python Library 3 min read Pandas Tutorial 4 min read Matplotlib Tutorial 5 min read Python Seaborn Tutorial 3 min read StatsModel Library - Tutorial 3 min read Learning Model Building in Scikit-learn 6 min read TensorFlow Tutorial 2 min read PyTorch Tutorial 6 min read Web Development with PythonFlask Tutorial 8 min read Django Tutorial | Learn Django Framework 7 min read Django ORM - Inserting, Updating & Deleting Data 4 min read Templating With Jinja2 in Flask 6 min read Django Templates 5 min read Build a REST API using Flask - Python 3 min read Building a Simple API with Django REST Framework 3 min read Python PracticePython Quiz 1 min read Python Coding Practice 1 min read Python Interview Questions and Answers 15+ min read Like