-4

My numbers like 3.8485341e-06, 9.9999619e-01, 2.9322797e-20. How can I turn them into a number between 0-1. For example 0.89, 0.47, 0.14

Alper Alp
  • 3
  • 5

2 Answers2

0

If you wish to format them into a string in the format you can use f"{x:.02f}".

>>> x = 9.9999619e-01
>>> f"{x:.02f}"
'1.00'

Or for older versions of Python, "{:.02f}".format(x).

orlp
  • 112,504
  • 36
  • 218
  • 315
0

You can get rid of the exponential form with this:

a=3.8485341e-06
'{0:.20f}'.format(a)

or this

print("%.20f" % a)
Arseniy
  • 680
  • 5
  • 10