-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
  • 4

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
  • 106,415
  • 33
  • 201
  • 300
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
  • 675
  • 5
  • 10