Python Math exp() Method
The Python Math exp() method returns the exponent e^x of x.
Python Math exp() Syntax
Here is the syntax of the exp() method:
import math
math.exp( x )
Note: exp() is not directly accessible, you need to import the math module and call the method through a static object.
Python Math exp() Parameters
- x – The numeric expression.
Python Math exp() Return Value
Returns the index of x: ex.
Python Math exp() Example#1
The following shows an example of using the exp() method.
#!/usr/bin/python3
import math
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:
Python Math exp() Example#2
#!/usr/bin/python3
import math
# checking for string
print (math.exp("25"))
Output: