What will be the output of the following Python function?
complex(1+2j)
complex(1+2j)A. Error
B. 1
C. 2j
D. 1+2j
Answer: Option D
Solution (By Examveda Team)
The correct answer is Option D: 1+2j.The complex() function in Python is used to create a complex number from real and imaginary parts. When you pass the expression 1+2j to the complex() function, it returns the complex number with real part 1 and imaginary part 2j.

Join The Discussion