Question 12
Back to Exercise
What is the output of the following Python program?
z = 3 + 4j
print(z.real, z.imag, abs(z), z * 1j)
- A 3.0 4.0 5.0 (-4+3j) Correct
- B 3 4 5 (3+4j)
- C 3.0 4.0 7.0 (-4+3j)
- D 3.0 4.0 5.0 (4-3j)
Correct Answer: Option A
The parts are floats. abs(3 + 4j) = √(9 + 16) = 5.0, and (3 + 4j) × j = 3j + 4j² = -4 + 3j.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!