[Tutor] Is there a better way to use scientific notation in an equation?
Eike Welk
eike.welk at gmx.net
Mon May 3 01:17:42 CEST 2010
On Sunday May 2 2010 22:44:42 David Hutto wrote:
> Q1 and Q2 are to be entered as base ten scientific notation.
> When I try to input Q1 as raw input, entering in ((2*(10**7)), I get:
>
> ValueError: invalid literal for int() with base 10: '((2)*(10**7))'
>
> Which is why I broke it down into it's sub-components(i.e. what to
> multiply the base 10 by[Q1mult] and what exponent to use with the base
> 10[Q1exp]).
>
> Is there a better way to write this, and what would be the best way to
> insert the
> scientific notation if not this way.
Maybe this is what you are looking for:
In [1]: 1e9
Out[1]: 1000000000.0
In [2]: float(raw_input())
1e9
Out[2]: 1000000000.0
Eike.
More information about the Tutor
mailing list