+ 1

How to round 20.0 in to 2 floating points in python 2.7??

28th Jan 2018, 11:28 AM
Sachitha Upeksha
Sachitha Upeksha - avatar
3 Antworten
+ 1
print '{:.2f}'.format(20.0)
2nd Feb 2018, 7:01 PM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar
+ 1
so what should be result of rounding 20.0 into 2 floating points?
2nd Feb 2018, 1:16 AM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar
0
20.00 should be the answer
2nd Feb 2018, 2:18 AM
Sachitha Upeksha
Sachitha Upeksha - avatar