programming-examples/python/Math/Print a complex number and its real and imaginary parts.py
2019-11-15 12:59:38 +01:00

5 lines
185 B
Python

#Initialize a complex number
cn = complex(2,3)
print("Complex Number: ",cn)
print("Complex Number - Real part: ",cn.real)
print("Complex Number - Imaginary part: ",cn.imag)