0

How to convert Float value to 2 digit after decimal in python?

avatar
Oct. 27, 2020
Hello,

here is my script:

a = 1
b = 3
c = a/b

This gives me a float value, but I want result with 2 digits after the decimal?
avatar
2020-03-30

Try
c = "%.2f" % (a/b)



Please Login to Comment