Re: [Tutor] creating the equivalent of string.strip()

2007-10-01 Thread Andrew James
I've gone ahead and created a script that does this, however it also strips punctuation. I was originally just comparing each character to a string containing a single space ' ' but even using s[-1].isspace() I lose punctuation marks. Any idea why that's happening? (Not the OP, I just thought t

Re: [Tutor] creating the equivalent of string.strip()

2007-10-02 Thread Andrew James
Helps if I send it to the group... And Kent, I didn't post it originally because I figured the other guy was still working on his script. Besides, I didn't think it'd be that far fetched for you to assume I was using something like "while s[0] == ' ':" Andre

Re: [Tutor] creating the equivalent of string.strip()

2007-10-02 Thread Andrew James
And as soon as I send it again I realise a pretty stupid error. The two loops shouldn't be nested. Andrew James wrote: > Helps if I send it to the group... > > And Kent, I didn't post it originally because I figured the other guy > was still working on his script. Beside

Re: [Tutor] creating the equivalent of string.strip()

2007-10-02 Thread Andrew James
*headbang* I'm an idiot. s=s[:-2] should be s=s[:-1]. Andrew James wrote: > And as soon as I send it again I realise a pretty stupid error. The > two loops shouldn't be nested. > > Andrew James wrote: >> Helps if I send it to the group... >> >> And Ken

Re: [Tutor] random number generator

2007-10-04 Thread Andrew James
I need to start using the reply all button... Andrew James wrote: > while guess != number: >guess = float(raw_input("Make another guess: ")) >if guess > number: >print "Lower..." >elif guess < number: >print "Highe

Re: [Tutor] random number generator

2007-10-06 Thread Andrew James
I'm tempted to suggest using a hack to avoid floating point errors. Anyway, it isn't choosing a number to ten decimal places. It's actually out to 11 in both examples you gave. And it evaluates to correct because your guesses were to at least 10 places, which is as far as you account for in the