Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to round to 3 significant figures in python

rounded_number =  round(a_number, significant_digits - int(math.floor(math.log10(abs(a_number)))) - 1)
Comment

round to 3 significant figures python

>>> round(1234, -3)
1000.0
Comment

PREVIOUS NEXT
Code Example
Python :: python boolean 
Python :: show post id on django admin interface 
Python :: python remove last 4 characters from string 
Python :: padding figures in pyplot 
Python :: python set union 
Python :: return key from value dictionary python 
Python :: datetime am pm python 
Python :: random forest 
Python :: __str__python 
Python :: boolean python example 
Python :: sum of the number in a list in python 
Python :: how to sort nested list in python 
Python :: text to speech program in python 
Python :: np.pad 
Python :: python run system commands 
Python :: filter dictionary python 
Python :: python input - how to read a number 
Python :: matplotlib subplots share x axis 
Python :: multiplication in python 
Python :: dictionary lookup python 
Python :: python self usage 
Python :: django filter on related field 
Python :: python tkinter scrollbar 
Python :: how to create multiple dictionaries in python 
Python :: count substring in string python 
Python :: python sum of 10 numbers from user input 
Python :: install python cap 
Python :: django connexion session time 
Python :: image analysis python 
Python :: extract all file in zip in python 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =