Converting numbers to words

Steve Holden steve at holdenweb.com
Thu Feb 5 21:42:25 EST 2009


todpose at hotmail.com wrote:
> I've been trying to figure this out for over 2 hours and I'm really
> frustrated right now.
> 
> I first made Python to ask user to input height in meters. If user puts
> certain value in meter, then it converts it to feet and inches as follows:
>  
> 
> Enter the height (in metres): 1.6
> 
> It is 5 feet, 3 inches high.
>  
>  
> What I want to do is to make it type only words. For example, instead of
> its saying, "It is 5 feet, 3 inches high," I want it to say, "it is five
> feet, three inches high."
> I'd appreciate any suggestions.

Create a list or tuple of strings, and use the numbers to index the list.

lst = ['a', 'b', 'c']
ndx = 1
print "The letter", lst[ndx], "is number one"

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list