Calculate up to two decimal places in Python -




this question has answer here:

i want calculate 2 decimal places in calculations can't

for example:

a = 93 b = 1 c = float(93/1) print c 

i want print :

93.00 

but print :

93.0 

is there function or there way this?

use explicit format float

print("%.2f" % round(c,2)) 

test on jupyter

https://try.jupyter.org/


enter image description here





wiki

Comments

Popular posts from this blog

elasticsearch - what is the equivalent data type for geo_point in hibernate search? -

firebase - How to wait value in Ionic 2 -

Jenkins: find build number for git commit -