On Wed, Jun 30, 2010 at 12:33, Alan Gauld wrote:
>
> "Aaron Chambers" wrote in message
> news:aanlktinh0ptfxhsbqrwiujml8nmuzcdcpqxscirhc...@mail.gmail.com...
>>
>> I'm new to Python, and wanted to start messing around with it, but the
>> computer I'm using is running Windows 7, so is there a vers
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 08:05:35 am Corey Richardson wrote:
> Hello Tutors!
> I'm having a problem with the find() method of string objects.
[...]
> The module documentation lists it as this: "S.find(sub[, start[,
> end]]) -> int".
> I'm assuming sub is the string you want to find, and that
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 01/07/2010 23:05, Corey Richardson wrote:
Hello Tutors!
I'm having a problem with the find() method of string objects. I'm
currently making a hangman game, and I'm making the part that finds
if there are multiple copies of the guessed letter in the word, and then
if there are, finds them all.
Hello Tutors!
I'm having a problem with the find() method of string objects. I'm
currently making a hangman game, and I'm making the part that finds
if there are multiple copies of the guessed letter in the word, and then
if there are, finds them all. I can't for the life of me figure out the
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
16 matches
Mail list logo