The cmath.exp() function calculates the value of e (Euler's number) raised to the power of x. Where is the input complex number.

Syntax:
cmath.exp(x)
copy
x The value(real or complex) whose exponent value is to be calculated.
Parameters:

The exp() function returns the value of e raised to the power of the complex number x,. If the input numbers is a real number, it is first converted to complex before the operation. The return value is always a complex number.

ExampleEdit & Run
import cmath

print(cmath.exp(2))
print(cmath.exp(complex(2, -1))) 
print(cmath.exp(1 + 2j))
print(cmath.exp(3 + 5j))
copy
Output:
(7.38905609893065+0j) (3.992324048441272-6.217676312367968j) (-1.1312043837568135+2.4717266720048188j) (5.697507299833739-19.26050892528742j) [Finished in 0.010844930540770292s]