How to calculate absolute value in Python?
The abs() capacity of Python’s standard library restores the supreme estimation of the given number. Outright estimation of a number is the incentive without thinking about its sign. Consequently supreme of 10 will be 10, – 10 is likewise 10. In the event that the number is a mind boggling number, abs() restores its extent.
>>> 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