Python abs() function

The abs() function returns the absolute value of a number.

Syntax

Parameter

x: The parameter ‘x’ can be an integer value, a floating point number or a complex number.

Return

This function returns the absolute value of a number, but if the argument is a complex number, its magnitude is returned.

Example 1

Output

Pin It on Pinterest

Share This