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, is used in place of i.


complex(a, b=0)

Wherecan 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 is used.


complex(3, 4)
complex(2, -3)
complex(2.3, 1.5)