convert currency to words

Andrew Dalke adalke at mindspring.com
Tue Dec 31 12:11:17 EST 2002


Laura:
 >But  <snip> ...five hundred sixty-seven and quintillion,  ... <snip>
 >should be 'five hundred and sixty-seven quintillion', no?  Is there a
 >bug in the code or the pasting of the answer?


Charles Krug:
> American practice is for "and" to go at the decimal point.
> 
> It's certainly easier to program that way.

What decimal point?  Here's a snippet of the relevant output

...234567890123456789012344
       ^^^

  ...two hundred and thirty-four sextillion, five hundred
                                             ^^^^^^^^^^^^
  sixty-seven and quintillion, eight hundred and ninety quadrillion,
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  one hundred and twenty-three trillion, four hundred fifty-six
  billion, seven hundred and eighty-nine million, twelve thousand,
  three hundred and forty-four

That should be "five hundred and sixty-seven quintillion"


Haven't identified the problem yet.  Any clue what

     if {$num > 20 && $num != $num/10} {

is supposed to do?  if $num == $num/10 then
                        10*$num == $num
                         9*$num == 0
                           $num == 0

and 0 is always < 20.

Unless it's some Tcl idiom I don't know about?

					Andrew
					dalke at dalkescientific.com




More information about the Python-list mailing list