ReferenceBuilt-in functions
abs()
The distance of a number from zero, so the sign is dropped.
Signature
abs(number)Parameters
| Name | Means |
|---|---|
number | an int, float or anything defining __abs__ |
Returns
The value without its sign, as the same type.
Example
Python
print(abs(-5))
print(abs(3.2))
print(abs(-3.2))Output
5 3.2 3.2