Answers for "print python 3 decimals"

25

python 2 decimal places

print(format(432.456, ".2f"))

>> 432.45

print(format(321,".2f"))

>> 321.00
Posted by: Guest on March-23-2020
24

round to two decimal places python

>>> x = 13.949999999999999999
>>> x
13.95
>>> g = float("{0:.2f}".format(x))
>>> g
13.95
>>> x == g
True
>>> h = round(x, 2)
>>> h
13.95
>>> x == h
True
Posted by: Guest on March-25-2020
1

print decimal formatting in python

a_float = 3.14159
formatted_float = "{:.2f}".format(a_float)
Posted by: Guest on September-14-2020
0

python print 2 decimal places

# this will print up to digits after decimal
print("%.2f" % (70/105))
Posted by: Guest on February-24-2020

Python Answers by Framework

Browse Popular Code Answers by Language