Python fabs function


Python fabs(x) function returns the absolute value of the float number x. It's a method of math module.

>>> import math
>>> math.fabs(-2)
2.0

>>> math.fabs(20)
20.0

>>> math.fabs(0)
0.0