0
How to get the next 2 digit of a number after division in python ?
5 ответов
+ 3
%[flags][width][.precision]type
%8.2f
print("%8.2f" % (1.235))
print("%8.2f" % (351.2))
+ 3
Another way of formatting:
"{:.2f}".format(1.234)
+ 1
# modern way (using f-strings):
print(f"{1.235:.2f}")
# f-string general informations and comparison with older format sequence:
# https://zetcode.com/JUMP_LINK__&&__python__&&__JUMP_LINK/fstring/
0
Do you mean, when we get 1.23, you want to have "23"?
0
If the number is 1.235 then I want 1.25
If no is 8.6 then 8.60