I have to convert this value to 23.69
or 23.70
not like that talll number 23.69098712446352
a=552.0
b=23.3
c=a/b
print(c)
I have to convert this value to 23.69
or 23.70
not like that talll number 23.69098712446352
a=552.0
b=23.3
c=a/b
print(c)
str.format
the output:
print("{:.2f}".format(c))
Or round:
round(c, 2)
Output:
In [9]: print(c)
23.6909871245
In [10]: print("{:.2f}".format(c))
23.69
In [11]: print(round(c, 2))
23.69
Two ways: round(a.b, 2)
Or just for display use this:
>>> "%.2f" % 3.14159
'3.14'
>>> print("%.2f" % a)