I am a bit confused by formatting the strings when I want to print a floating point number. For example when I have %6.2f I expect the print function to give me a number with 6 digits including 2 digits in its decimal part. So, when I write the following statements:
mRa = 569.34643865
print("result %6.2f" %mRa)
The outcome will be result 569.35.
But when I change the second line of the code to print("result %1.0f" %mRa), the result is result 569, while I expected to see only the first digit of the number. Additionally, if I change that line of the code to print("result %3.0f" %mRa), the result would be exactly the same. I would appreciate if someone can explain to me why do we have such a (conflicting) observation?
.formator f-strings. the%, printf-style formatting is all but deprecated, and indeed, explicitly advised against in the documentation.