- Well Python not only handle the real number but also handle the complex numbers with the help of Complex function in python.
- This complex function is so useful to manipulate mathematics problem's.
- complex function in python return the real number from complex number or convert the string to a complex number.
|
Example Program For Complex Function In Python
|
Parameter : -
- real - real part. If real is extinct then it defaults to 0.
- imag - imaginary part. If imag is extinct then it defaults to 0.
Return the complex number.
Example of Complex function in Python To Create a complex number:-
z = complex(2, 3)
print(z)
z = complex(2)
print(z)
z = complex()
print(z)
z = complex('4-5j')
print(z)
(2+3j)
(2+0j)
0j
(4-5j)