The Python built-in function "abs()" returns the absolute value of a number. The absolute value is the numerical value of a number without regard to its sign. For example, the absolute value of -5 is 5 and the absolute value of 5 is also 5. The function can be used with both integers and floating-point numbers. The general syntax for using the abs() function is:
abs(x)
where x is the number whose absolute value is to be returned.
Example
>>> abs(-5)
5
>>> abs(5)
5
>>> abs(-3.14)
3.14
Younes Derfoufi
my-courses.net
my-courses.net
[…] Python abs(): It returns the absolute value of a number and the returned value is always positive. […]