can you help guys?

Steven D'Aprano steve+comp.lang.python at
Fri Apr 24 01:19:50 CEST 2015

On Fri, 24 Apr 2015 01:51 am, brokolists wrote:

> my problem is i m working with very long float numbers and i use
> numberx =float(( input( 'enter the number\n ')))
> after i use this command when i enter something more than 10 or 11 digits
> it uses like 1e+10 or something like that but i have to calculate it
> without scientific 'e' type. what can i do to solve this? (sorry for my
> bad english)

Are you sure? Can you give an example? This works for me:

py> s = input("Enter a number: ")
Enter a number: 0.123456789012345
py> len(s) - 2  # Number of digits
py> x = float(s)
py> print(x)

Maybe you shouldn't be using floats:

py> n = int(input("Enter a number: "))
Enter a number: 123456789012345678901234567890
py> print(n)
py> print(n+1)

Integers will not use scientific "e" notation, but floats will. But that is
only the *display* format:

py> x = float(input("Enter a number in Sci format: "))
Enter a number in Sci format: 1.234e10
py> print(x)
py> print("%f" % x)
py> print("%g" % x)

Notice that displaying the float with %f and %g format codes look different,
but are the same number.

You will need to explain more about what you are trying to do before we can
give you good advise. Perhaps if you show us some examples?


More information about the Python-list mailing list