Answers for "float set limit python 9 decimal p"

3

how do i limit decimals to only two decimals in python

answer = str(round(answer, 2))
Posted by: Guest on May-24-2020
-1

python decimal precision, float

#!/usr/bin/python

from decimal import Decimal

x = 1 / 3
print(type(x))
print(x)

print("-----------------------")

y = Decimal(1) / Decimal(3)
print(type(y))
print(y)
Posted by: Guest on June-25-2021

Code answers related to "float set limit python 9 decimal p"

Python Answers by Framework

Browse Popular Code Answers by Language