Re: changing numbers to spellings

2006-10-04 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > You should get some clue about the number conversion (not to menion a > bunch of code you can lift :) from > > http://www.python.org/pycon/dc2004/papers/42/ex1-C/num2eng.py For some reason I felt like writing another one, that doesn't use as much re

Re: changing numbers to spellings

2006-10-01 Thread Paul McGuire
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] wrote: >> Hey, >> >> Sorry to bother everybody again, but this group seems to have quite a >> few knowledgeable people perusing it. >> >> Here's my most recent problem: For a small project I am doing, I

Re: changing numbers to spellings

2006-10-01 Thread MonkeeSage
Tim Williams wrote: > my_nums = { 1 : 'One' , 2 : 'Two' , 3 : 'Three' , 4 : 'Four' } # etc etc > print my_nums[x] That's what I suggested, but since a list is already zero indexed I used that rather than a dictionary. And Paul Rubin posted a very nice solution that handles numbers larger than 9.

Re: changing numbers to spellings

2006-10-01 Thread Tim Williams
On 1 Oct 2006 14:08:24 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I guess I'm just looking for a small code sample hooked up to the code > I gave, that would collect the input, compare it to code such as: > > if x==5 > print "Five" > elif x==6 > print "Six" > elif x==7 > p

Re: changing numbers to spellings

2006-10-01 Thread [EMAIL PROTECTED]
I guess I'm just looking for a small code sample hooked up to the code I gave, that would collect the input, compare it to code such as: if x==5 print "Five" elif x==6 print "Six" elif x==7 print "Seven" Something along those lines. That was actually like the code I used for someth

Re: changing numbers to spellings

2006-09-30 Thread Paul Rubin
"MonkeeSage" <[EMAIL PROTECTED]> writes: > If you need the actual names for like "Five Hundred and Sixty Seven", I > think one of the smart people 'round here will have to help with that. > I have some ideas, but I'm not very good at creating complex > algorithms. These kinds of things are general

Re: changing numbers to spellings

2006-09-30 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hey, > > Sorry to bother everybody again, but this group seems to have quite a > few knowledgeable people perusing it. > > Here's my most recent problem: For a small project I am doing, I need > to change numbers into letters, for example, a person typing in the > numbe

Re: changing numbers to spellings

2006-09-30 Thread MonkeeSage
[EMAIL PROTECTED] wrote: > Hey, > > Sorry to bother everybody again, but this group seems to have quite a > few knowledgeable people perusing it. Hi Tanner, I've seen a few of those people; but let a dummy (me) try to help. ;) As to the numbers to names question: do you need to know the names of

changing numbers to spellings

2006-09-30 Thread [EMAIL PROTECTED]
Hey, Sorry to bother everybody again, but this group seems to have quite a few knowledgeable people perusing it. Here's my most recent problem: For a small project I am doing, I need to change numbers into letters, for example, a person typing in the number '3', and getting the output 'Three'. So