How to round off the values to 2 decimal? And what is the module name to import? | Sololearn: Learn to code for FREE!
Nowy kurs! Każdy programista powinien nauczyć się Generative AI!
Wypróbuj darmową lekcję
0

How to round off the values to 2 decimal? And what is the module name to import?

How to round off the values to 2 decimal? And what is the module name to import?

2nd Mar 2018, 1:54 PM
Sashank Reddy
Sashank Reddy - avatar
2 odpowiedzi
+ 3
round(value,2) where value is the decimal number. It is a build in function so you don't need to import library.
2nd Mar 2018, 2:01 PM
Geo
Geo - avatar
+ 3
number=12.3456778 print("%.2f" % number) output- 12.35
2nd Mar 2018, 2:09 PM
LordHill
LordHill - avatar