How to force python to keep the trailing zeros?

Write: print(0.100)
And displays: 0.1

How to make derived: 0.100
April 4th 20 at 00:27
1 answer
April 4th 20 at 00:29
Solution
To make you cannot save, what you want is called formatted output, which is well described in the documentation.
Thank you found. Now, if someone will need.
>>> "%.4f" % (4/3)
'1.3333' - hattie.Larso commented on April 4th 20 at 00:32
Make cannot be saved

lzya - Ursula.Ratke commented on April 4th 20 at 00:35
@Ursula.Ratke, not because I'm psychic and I see that the author just need the output, not Decimal, with whom he had problems in order to grow. - russell66 commented on April 4th 20 at 00:38
@russell66, and he now needs a conclusion, in the next step you will need a Mat. operation. But if numbers with different number of decimal places? Type 0,65300 will be clipped to the single zero in the case of formatting specified by the author. In any case, to write "Make cannot be saved" = to cheat, and it's bad. - Ursula.Ratke commented on April 4th 20 at 00:41
@Ursula.Ratke, at this level of language learning you can - russell66 commented on April 4th 20 at 00:44
@russell66, at this level of study it is important to instill the habit of doing the right thing and additional study material, not just to work. - Ursula.Ratke commented on April 4th 20 at 00:47
@Ursula.Ratke, he containers not mastered, now it will be a problem to master Decimal('0.100') vs Decimal(0.100) - russell66 commented on April 4th 20 at 00:50
@Ursula.Ratke, do you suggest any float import decimal? Chota I do not understand. Brow need a conclusion to draw, and trailing zeros and float master, if need be - anibal.Wiso commented on April 4th 20 at 00:53

Find more questions by tags Python