![]() |
|
#1
|
|||
|
|||
Ideas for number to english equivalent programI 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
|
||||
|
||||
Re: Ideas for number to english equivalent programI 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 GIDBlog
Meeting the local Iraqis by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
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