On Thu, Jul 1, 2010 at 16:18, Steven D'Aprano wrote:
> On Fri, 2 Jul 2010 05:18:00 am Eike Welk wrote:
>
>> As you are using long integers (and you were previously writing about
>> prime numbers) the precision of floating point numbers might not be
>> enough for your purposes.
>
> It certainly won
On Fri, 2 Jul 2010 05:18:00 am Eike Welk wrote:
> As you are using long integers (and you were previously writing about
> prime numbers) the precision of floating point numbers might not be
> enough for your purposes.
It certainly won't be once you get to large enough primes!
> Therefore you sho
On Thu, Jul 1, 2010 at 12:18, Eike Welk wrote:
> Therefore you should probably use the integer division operator: "//"
>>> x = 200033
>>> x//2
100016
I can live with THAT error!
Thanks, Eike!
But I will press on with Mark
On 01/07/2010 20:18, Eike Welk wrote:
Hello Richard!
On Thursday July 1 2010 15:11:21 Richard D. Moores wrote:
Thanks to yours and others responses, I've learned some things I
didn't know, but remember, I'm starting with long ints such as
Also note that in Python 3 the "/" (division) operator
Hello Richard!
On Thursday July 1 2010 15:11:21 Richard D. Moores wrote:
> Thanks to yours and others responses, I've learned some things I
> didn't know, but remember, I'm starting with long ints such as
Also note that in Python 3 the "/" (division) operator returns a floating
point number when
On Thu, Jul 1, 2010 at 09:25, Mark Lawrence wrote:
> Take a look at section 7.1.3 here.
>
> http://docs.python.org/py3k/library/string.html#string-formatting
>
> This is the recommended way to format strings in Python 3.
Thanks, Mark. Looks good, if cryptic. I don't have time to dig into it
now
On 01/07/2010 14:11, Richard D. Moores wrote:
On Thu, Jul 1, 2010 at 04:57, Steven D'Aprano wrote:
On Thu, 1 Jul 2010 06:26:21 pm Richard D. Moores wrote:
x = 2034
x/2
1017.0
print(x/2)
1e+15
I was expecting, in fact needing, 117 or
1000
On Thu, Jul 1, 2010 at 04:57, Steven D'Aprano wrote:
> On Thu, 1 Jul 2010 06:26:21 pm Richard D. Moores wrote:
>> >>> x = 2034
>> >>> x/2
>> 1017.0
>>
>> >>> print(x/2)
>> 1e+15
>>
>> I was expecting, in fact needing, 117 or
>> 117.0
>>
>> 1e
On Thu, 1 Jul 2010 06:26:21 pm Richard D. Moores wrote:
> >>> x = 2034
> >>> x/2
> 1017.0
>
> >>> print(x/2)
> 1e+15
>
> I was expecting, in fact needing, 117 or
> 117.0
>
> 1e+15 is unsatisfactory. Am I forced to use the decimal module?
This
x = 2034
x/2
> 1017.0
print(x/2)
> 1e+15
>
> I was expecting, in fact needing, 117 or 117.0
>
> 1e+15 is unsatisfactory. Am I forced to use the decimal module?
Can't you use string formatting? Eg:
>>> print("{0:15.0f}".format
without using decimal module:
>>> x = 2034
>>> print('%d'%(x/2))
1017
On Thu, Jul 1, 2010 at 13:56, Richard D. Moores wrote:
x = 2034
x/2
> 1017.0
print(x/2)
> 1e+15
>
> I was expecting, in fact needing, 117 or 1
>>> x = 2034
>>> x/2
1017.0
>>> print(x/2)
1e+15
I was expecting, in fact needing, 117 or 117.0
1e+15 is unsatisfactory. Am I forced to use the decimal module?
Dick Moores
___
Tutor maillist - T
12 matches
Mail list logo