[Tutor] Order Of Operations Question
Dave Angel
davea at ieee.org
Thu Jul 29 02:03:47 CEST 2010
David Hutto wrote:
> <snip>
> I'll probably ending up reading something about it later in the book,
> but as a quick question, why does:
>
>
>>>> 5e18 =5**18
>>>>
> False
>
>>>> int(5e18) =int(5**18)
>>>>
> False
>
>>>> 1.01325e5 =1.01325**5
>>>>
> False
>
>
The 999e44 notation is intended to be similar to scientific notation,
where 44 is the exponent, in base 10.
So redoing your equalities:
5e18 == 5*(10**18)
int(5e18) == int(5 * 10**18)
1.01325e5 == 1.01325 * 10**5
The extra parens in the first case, and the extra spaces in the others, are just for readability. It'd be just as correct to say:
1.01325e5 == 1.01325*10**5
DaveA
More information about the Tutor
mailing list