Answer the question
In order to leave comments, you need to log in
Is it possible to discard k decimal places in float in Python?
Hello, next question.
Let's say there is a number 17.212123445 ...
And you need to write to memory only the first digit after the decimal point. How to do this using real and integer operations?
Answer the question
In order to leave comments, you need to log in
There is also a fractions module. It allows you to "correctly" perform floating point calculations. If you just want to save, then the answer is correct.
If you don't understand what I'm talking about, just run this code:'{:.30}'.format(17.33333333)
https://pythonworld.ru/osnovy/okruglenie.html
Maybe not quite right, but in my case, I was looking for exactly this
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question