complex
data type represents the extension of a real number system in which all numbers are expressed as a sum of a real part and an imaginary part. Imaginary numbers are real multiples of the imaginary unit(whose value is a square root of -1).
Python supports complex numbers, which are written with this latter notation; the imaginary part is written with a j suffix, e.g., 3+1j.
And the complex numbers are stored as a pair of machine-level double-precision floating point numbers.
Complex numbers can be simply initialized as a sum of real and imaginary parts:
>>> 1+2j
(1+2j)
>>> 1.0+2.0j
(1+2j)
Syntax:
complex.real
Example:
>>> (1+3j).real
1.0
Syntax:
complex.imag
Example:
>>> (1+3j).imag
3.0
Syntax:
complex.conjugate()
Example:
>>> (1+3j).conjugate()
(1-3j)