3.6) Complex Numbers
There is also a 'complex number' type in Python, which consists of a pair of two floats, a real part and an imaginary part. The imaginary part is written with a suffix of "j" or "J". Here is how you would write imaginary numbers:
>>> type(1j) <type 'complex'> >>> a=1+2j >>> a (1+2j)
You can also create a complex number with the function complex(real, imag), where real is the real part and imag the imaginary part of the complex number.
>>> complex(0,1) 1j