ROUNDING NUMBERS IN PYTHON: Simple way to round without rounding up and two methods of rounding up.

preview_player
Показать описание
This is a quick video to answer the frequently asked question "How to round without rounding up in Python". The video shows a quick method dividing the number by 0.01 to return the whole number then dividing by 100 to show to 2dp. You change the 0.01 value to suit the length of digits before the decimal place.

This video also shows the round method and the placeholder method of returning the round of a number.

Many thanks to:
Presented by: Jason Machin
Рекомендации по теме
Комментарии
Автор

thank you. searched 30 minutes to find a simple, straightforward answer

shannonstumpf
Автор

You can also use: print ( f ' { num : . 2f } ' )

BERNARDOMORAISAVELARLIMA
Автор

If i dont want to round off numbers and get it as it is.. What to do... Long numbers like 0205001616171717 gets rounded off to 0205002 in python. But we dont want like that. We want full number

caankitrmehta