Custom Search

PYTHON: Significant Figures

To express a number in a fixed number of signgificant figures we can do the following - it is almost the same code as that to round a number.....

Let us choose a number with a large number of digits and express it in only 3....

n=45568.349257
print(f"{n:.3}")

This will result in 4.56 x 104

n=0.00349257
print(f"{n:.3}")

This results in an outcome of 0.00349

So you don't get an outcome in standard form every time.