Python abs() Function
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
Enjoying these tutorials?