Vidyalelo
Python · Q27

Python Built

Programming · Python · question 27

Q27

What will be the output of the following Python function? complex(1+2j)

A.
Error
B.
1
C.
2j
D.
1+2j
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
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.