Python abs() Function
ExampleGet your own Python Server
Return the absolute value of a number:
x = abs(-7.25)
Try it Yourself »
Definition and Usage
The abs()
function returns the absolute
value of the specified number.
Syntax
abs(n)
Parameter Values
Parameter | Description |
---|---|
n | Required. A number |