complex « Data Type « Python Tutorial






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