We are trying to convert some qbasic scripts into python scripts. The scripts are used to generate some reports. Generally the reports generated by qbasic and python scripts should be exactly same. While generating a report we need to format a floating point number in a particular format. We use the following commands for formatting the number.
For QBASIC, we use
PRINT USING "########.###"; VAL(MYNUM$)
For Python, we use
print('{:12.3f}'.format(mynum))
where MYNUM$ and mynum having the floating point value.
But in certain cases, the formatted value differs between python and qbasic.
The result become as follows,
Can anyone help me to sort out this problem and make the python formatting work like qbasic?