How to calculate the absolute value of float in Python

1 Answer

0 votes
import math
 
print(math.fabs(-1.1))     
print(math.fabs(-0.0))
print(math.fabs(0.0))     
print(math.fabs(1.1))
print(math.fabs(-2.3))
print(math.fabs(2.3))



'''
run:

1.1
0.0
0.0
1.1
2.3
2.3

'''

 



answered Jun 30, 2019 by avibootz

Related questions

1 answer 103 views
2 answers 118 views
1 answer 122 views
122 views asked Jan 23, 2023 by avibootz
1 answer 132 views
...