> If you want value % 100/10 to give the same result in Python 2.6 and
> Python 3 you can use value % 100//10 which will always use integer
> division.
>
Kent, thanks for anticipating this. I actually was struggling to
figure out how to update the division and wasn't certain how.
Below is the ful
On Thu, Feb 4, 2010 at 1:21 PM, Serdar Tumgoren wrote:
>> Perhaps the code on activestate is not a correct copy of what you are
>> running? The conditional at line 23 extends all the way to line 35 -
>> the end of the function - so if value % 100/10 == 1 no more code is
>> executed and None is ret
> It now works ok but..
>
> You should not use ord as variable as ord() is used by python already.
>
> Also this will fail in python 3 and 2 with import from future, it does
> division differently.
from __future__ import division
11 % 100 / 10
> 1.1001
>
> So "if value % 100/1
On do, 2010-02-04 at 13:30 -0500, Serdar Tumgoren wrote:
> Could you all indulge me one last time and tell me if the above
> version works for you? If so, I'll update the recipe to spare others a
> similar headache.
It now works ok but..
You should not use ord as variable as ord() is used by pyth
On Thu, Feb 4, 2010 at 12:30 PM, Serdar Tumgoren wrote:
>
> Geez -- I think I found the (now-obvious) mistake. If you compare the
> above to the ActiveState recipe, it's obvious that I forgot to copy
> over the final, outer "else:" clause.
>
> Could you all indulge me one last time and tell me if
On Thu, Feb 4, 2010 at 1:21 PM, Serdar Tumgoren wrote:
>> Perhaps the code on activestate is not a correct copy of what you are
>> running? The conditional at line 23 extends all the way to line 35 -
>> the end of the function - so if value % 100/10 == 1 no more code is
>> executed and None is ret
> Perhaps the code on activestate is not a correct copy of what you are
> running? The conditional at line 23 extends all the way to line 35 -
> the end of the function - so if value % 100/10 == 1 no more code is
> executed and None is returned.
>
Here is the code that I'm running locally (hopeful
On Thu, Feb 4, 2010 at 1:09 PM, Kent Johnson wrote:
> On Thu, Feb 4, 2010 at 12:11 PM, Serdar Tumgoren wrote:
>> Here's the link to the recipe:
>>
>> http://code.activestate.com/recipes/576888/
>
> Perhaps the code on activestate is not a correct copy of what you are
> running? The conditional a
On Thu, Feb 4, 2010 at 12:11 PM, Serdar Tumgoren wrote:
> I just noticed, however, that in the comments section of the
> ActiveState recipe that someone is getting incorrect results for
> certain numbers (11 and 12, specifically).
>
> But when I use the code on my own machine it still works fine.
> No time to search for the issue, but here are some trials (hole from 10 -->
> 19):
> for i in range(21):
> print "%s\t: %s" %(i,ordinal(i))
> for i in (-1,22,33,99,100,101,199,200,999,1000):
> print "%s\t: %s" %(i,ordinal(i))
> ==>
> 0 : 0th
> 1 : 1st
> 2 : 2nd
>
"Serdar Tumgoren" wrote
was hoping that you all could help me "crowdsource" the issue. If you
have the time and inclination, could you look at the code and tell me
if and where I've gone wrong?
Not sure about the reported bugs but some comments:
What happens if
if value % 100/10 <> 1is fal
On Thu, Feb 4, 2010 at 11:11 AM, Serdar Tumgoren wrote:
> Hi folks,
>
> I just noticed, however, that in the comments section of the
> ActiveState recipe that someone is getting incorrect results for
> certain numbers (11 and 12, specifically).
>
> But when I use the code on my own machine it sti
On Thu, 4 Feb 2010 12:11:24 -0500
Serdar Tumgoren wrote:
> Hi folks,
>
> A few months back I posted my first (and only) "recipe" to
> ActiveState. It was just a little function to convert an integer or
> its string representation to an ordinal value: 1 to 1st, 2 to 2nd,
> etc.
>
> Not sure if t
Hi folks,
A few months back I posted my first (and only) "recipe" to
ActiveState. It was just a little function to convert an integer or
its string representation to an ordinal value: 1 to 1st, 2 to 2nd,
etc.
Not sure if this really qualifies as a recipe, per se, but it was a
handy little functio
14 matches
Mail list logo