+ 5
Please explain the output for print(abs(3+4j))
How output comes 5.0
6 Answers
+ 29
Absolute value is actually the distance between a given number and 0. If you think of a complex number as a two-dimensional tuple (for real and imaginary parts, respectively), you have, let's say:
3 + 4i (or 3 + 4j in Python)
Now, the distance is the square root of the sums of squares, so:
â(3² + 4²) = â(9 + 16) = â(25) = 5.0
+ 2
thanks kuba, nicely explained
+ 1
In python j after a number makes the number imaginary, see more here:
https://stackoverflow.com/questions/8370637/complex-numbers-usage-in-python
+ 1
thanks
+ 1
Thanks for answering
+ 1
5.0 is the answer
Well it worked for me atleast