+1 vote
in Programming Languages by (66.2k points)
I want to print decimal numbers in scientific notation e.g. 1e-5. Is there any function in Python for it?

1 Answer

+2 votes
by (66.8k points)
selected by
Best answer

You can display a decimal number in scientific notation without using any function.

In the following example, there will be two digits after the decimal point. If you want more digits after the decimal point, you can change 2 to the number of digits you want.

>>> print("{:.2e}".format(0.00038625))