Число деления Python без потери значения ⇐ Python
-
Anonymous
Число деления Python без потери значения
I have below code
number = 10 for i in range(3): print(round(10/3,2)) The output is
3.33 3.33 3.33 But I need output like
3.33 3.33 3.34 I want to add rest for last item.
I can do like dividing one less time, then subtract the total divided value from original, but I am looking is there anything inbuilt.
How can I get that.. Thanks,
Источник: https://stackoverflow.com/questions/780 ... sing-value
I have below code
number = 10 for i in range(3): print(round(10/3,2)) The output is
3.33 3.33 3.33 But I need output like
3.33 3.33 3.34 I want to add rest for last item.
I can do like dividing one less time, then subtract the total divided value from original, but I am looking is there anything inbuilt.
How can I get that.. Thanks,
Источник: https://stackoverflow.com/questions/780 ... sing-value