Python complex() function in Python is used to return a complex number by specifying a real number or string. This function contains two parameters, the first parameter is called a real and second as imaginary parts.
|real||It is a Required numeric parameter. It represents the real part of the complex number and its default value is 0.|
|imaginary||It is an Optional parameter. It represents the imaginary part of the complex number and its default value is 0.|
Here is an Example
a = complex(7,12) print(a)
x = complex(3.7) y = complex(2.3,72.8) print(x) print(y)