GIDForums  

Go Back   GIDForums > Computer Programming Forums > Python Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-Nov-2006, 20:27
briand briand is offline
New Member
 
Join Date: Nov 2006
Posts: 2
briand is on a distinguished road

Ideas for number to english equivalent program


I need to make a python program that converts a number(between 1 and 9999.99) to its english equivalent(ex. 1345 - one thousand three hundred fourty five). Any suggestions would help. Include code please
  #2  
Old 01-Nov-2006, 22:43
crystalattice's Avatar
crystalattice crystalattice is offline
Flame War Instigator
 
Join Date: Apr 2004
Location: San Diego
Posts: 1,539
crystalattice is just really nicecrystalattice is just really nicecrystalattice is just really nicecrystalattice is just really nicecrystalattice is just really nice

Re: Ideas for number to english equivalent program


I don't have any code to give you, though have you considered looking at the Python code repositories, like the Python Activestate site?

I would imagine that you would make the logic to determine how many digits are in the number, then more or less parse out each digit, setting it to a string value. Then you could just concatenate the strings.

For example, given 989, determine how many numbers are in this number (in this case three). Have a loop separate each number and determine its position: 9 (hundreds), 8 (tens), 9 (ones). Use elif statements to match each number and position to string value: nine hundred, eighty, and nine. Then finally concatenate each string value to give you the whole number.

Hope this helps you out.
__________________
Common Sense v2.0-Striving to make the world a little bit smarter.
 
 

Recent GIDBlogMeeting the local Iraqis by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Number to English Equivalent briand Python Forum 0 01-Nov-2006 18:38
Pipeline freeze simulation darklightred C++ Forum 6 27-Jul-2006 19:37
How to read particular memory location ? realnapster C Programming Language 10 10-May-2006 09:11
D3D error when running fullscreen games/programs - help?! daa709 Computer Hardware Forum 4 01-Jul-2005 08:03
Type casts ? kai85 C++ Forum 12 23-Jun-2005 12:04

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:23.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.