Return absolute value:
#Import math Library
import math
#Print absolute values from numbers
print(math.fabs(-66.43))
print(math.fabs(-7))
Try it Yourself » Definition and UsageThe math.fabs()
method returns the absolute value of a number, as a float.
Absolute denotes a non-negative number. This removes the negative sign of the value if it has any.
Unlike Python abs(), this method always converts the value to a float value.
Syntax Parameter Values Parameter Description x Required. A number. If we try anything else except a number, it returns a TypeError Technical Details Return Value: Afloat
value, representing the absolute value of x Python Version: 2.6
Track your progress - it's free!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4