How can i output result of my calculation with a precision of 2 digits after the comma | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

How can i output result of my calculation with a precision of 2 digits after the comma

format a float to get 2 digits after the comma for eg. in language like java and c++ we use printf instead of print or println

3rd Nov 2016, 7:50 PM
TheDon_P
TheDon_P - avatar
2 ответов
+ 3
If the number is 56.62920 pritnt(round(56.62920, 2)) #output: 56.63
3rd Nov 2016, 8:11 PM
Popolizio Domenico
0
thanks popolizio for the quick reply
3rd Nov 2016, 8:58 PM
TheDon_P
TheDon_P - avatar