xxxxxxxxxx
# Using the abs function in Python
number = -5
absolute_value = abs(number)
print(absolute_value)
xxxxxxxxxx
print ("abs(-45) : ", abs(-45))
print ("abs(100.12) : ", abs(100.12))
output:
45
100.12
xxxxxxxxxx
Help on built-in function abs in module __builtin__:
abs( )
abs(number) -> number
Return the absolute value of the argument.