?
What will be the output of the following Python function?
What will be the output of the following Python function?
complex(1+2j)
complex(1+2j)
Answer & Solution
Correct Answer:
Option
D
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.
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
Login to post a comment or share your explanation.
Login