import cmath for Complex number : complex « Data Type « Python Tutorial






import cmath 
print cmath.sqrt(-1) 
print (1+3j) * (9+4j)








2.2.complex
2.2.1.import cmath for Complex number
2.2.2.Complex Number Attributes
2.2.3.imaginary numbers are written with a suffix of "j" or "J"
2.2.4.To extract these parts from a complex number z, use z.real and z.imag.
2.2.5.Use abs(z) to get its magnitude (as a float) or z.real to get its real part
2.2.6.Complex Math