The complex()
function is used to construct a complex number from two values representing the real parts and the imaginary part. If it is called without any argument, it returns the complex number 0j.
A complex number is a number that can be written in the form a + bi where a and b are real numbers and i is the imaginary unit, that satisfies the equation i^2= -1. In Python, j is used in place of i.
complex(a, b=0)
copy
Where a
can be an integer, a float, a string, or another complex number. If a is a string, the second argument is not included.
If b is not given, the integer 0 is used.