convert currency to words

Terry Hancock hancock at anansispaceworks.com
Tue Dec 31 21:10:46 EST 2002


Um, a bit of testing reveals that we need to specify long ints:

num  =	{
	'oh':0L, 'a': 1L, 'an': 1L,
	'zero':0L, 'one':1L, 'two':2L, 'three':3L, 'four':4L,
	'five':5L, 'six':6L, 'seven':7L, 'eight':8L, 'nine':9L,
	'ten':10L, 'eleven':11L, 'twelve':12L, 'thirteen':13L,
	'fifteen':15L, 'eighteen':18L, 
	'twenty':20L, 'thirty':30L, 'forty':40L, 'fifty':50L,
	'eighty':80L, 'score':20L,
	'hundred':100L, 'thousand':1000L, 'million':1000000L,
	'millions':1000000L, 'billion':1000000000L,
	'billions':1000000000L,
	'trillion':(10L**12), 'quadrillion':(10L**15),
	'quintillion':(10L**18), 'sextillion':(10L**21),
	'septillion':(10L**24), 'octillion':(10L**27),
	'nontillion':(10L**30), 'decillion':(10L**33)
	}

Otherwise it seems to work okay.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com

"Some things are too important to be taken seriously"





More information about the Python-list mailing list