Web Analytics

Python abs() Function

Math Function Absolute Value

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

Syntax

abs(n)

Parameters

Parameter Description
n Required. A number

Return Value

The absolute value of the number (always positive).

Example

Using the abs() function:

Output
Click Run to execute your code

Related Functions