Complex() method in Python Built in Function Method
Complex method in built in function returns complex numbers when real and imaginary parts are given as input. It also converts a string into complex number.
Syntax:
Complex ([real[, imag]])
Parameter
Complex method has 2 parameters
- Real: if this parameter is removed the default value is 0
- Imag: if this parameter is removed the default value is 0
Example-1:
x = complex(1) print(x)
Output:

Example-2:
x = complex(3,-9) print(x)
Output:

Example-3:
x = complex() print(x)
Output:

Example-4:
x = complex(9+8j) print(x)
Output:
