Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

round to decimal places python

floatNumber = 2.13400
#Method 1: use f-strings
print(f"{floatNumber:.5f}") #Output: 2.13400 == '%.5f'%floatNumber
#Method 2: use round
print(round(floatNumber,5)) #Output: 2.134
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #decimal #places #python
ADD COMMENT
Topic
Name
9+5 =