Added example of absolute value of complex number (#23638)
This commit is contained in:
@ -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
|
||||||
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user