Added example of absolute value of complex number (#23638)

This commit is contained in:
raviram
2018-12-12 01:13:20 +05:30
committed by Paul Gamble
parent d9d1776a84
commit 31bc19174f

View File

@ -56,4 +56,14 @@ A `string` can also be used as the argument. No second argument is allowed if a
```python ```python
>>> complex("1.1+3.5j") >>> complex("1.1+3.5j")
(1.1+3.5j) (1.1+3.5j)
``` ```
We can obtain the absolute value of a complex number using the abs() method in python.
```py
>>> a=2+3j
>>> abs(a)
3.605551275463989
>>> b=-1+1j
>>> abs(b)
1.4142135623730951
```