How to get the absolute value of a floating point (float) value in Python

1 Answer

0 votes
import math

print(math.fabs(-1.1))
print(math.fabs(1.1))
print(math.fabs(0))
print(math.fabs(-0))
print(math.fabs(-0.5))


'''
run:

1.1
1.1
0.0
0.0
0.5

'''

 



answered Oct 13, 2017 by avibootz
...