0 votes
in Python by (30.5k points)
--> absolute value python

How to calculate absolute value in Python?

1 Answer

0 votes
by (30.5k points)
How to calculate absolute value in Python?

PythonServer Side ProgrammingProgramming

The abs() function of Python's standard library returns the absolute value of the given number. Absolute value of a number is the value without considering its sign. Hence absolute of 10 is 10, -10 is also 10. If the number is a complex number, abs() returns its magnitude.

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

Related questions

...