python-absolute-value

Python Absolute Value

How to calculate absolute value in Python?

The abs() capacity of Python’s standard library restores the outright estimation of the given number. Supreme estimation of a number is the incentive without thinking about its sign. Consequently outright of 10 will be 10, – 10 is likewise 10. In the event that the number is an intricate number, abs() restores its greatness.

Example

>>> abs(11.11)
11.11
>>> abs(-11.11)
11.11
>>> abs(2+3j)
3.605551275463989
>>> abs(3-6j)
6.708203932499369
>>> abs(3-4j)
5.0