+ 1
Showing decimal places
When I create a formula in my code and I only want my answer to display 2 digits after the decimal, how do I write my code for it?
2 Answers
+ 5
Try formatting it like this maybe:
x = 3.542558582882855
print('%.2f' % x)
>>>
3.54
+ 4
use setprecision key word for that purpose .