You are here : python_3Built-in Functionsabs

abs() - Built-in Functions

Return the absolute value of a number.

The argument may be an integer or a floating point number.

If the argument is a complex number, its magnitude is returned.


Syntax

abs(x)


Example

mag=abs(5+5j)	# finds magnitude of complex number 5+5j = 7.07106
a=abs(-8.5)	# absolute of -8.5 = 8.5


Output / Return Value

Return the absolute value of a number.


Limitations


Alternatives / See Also


Reference