Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Speech Module by amber_kshz
FIRST_TEN = ["one", "two", "three", "four", "five", "six", "seven",
"eight", "nine"]
SECOND_TEN = ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
"sixteen", "seventeen", "eighteen", "nineteen"]
OTHER_TENS = ["twenty", "thirty", "forty", "fifty", "sixty", "seventy",
"eighty", "ninety"]
HUNDRED = "hundred"
def checkio(number):
out = ''
if number/100 > 0:
out += '%s hundred '%(FIRST_TEN[number/100-1])
number = number%100
if number/10 == 1:
out += '%s'%(SECOND_TEN[number-10])
return out
elif number/10 > 1:
out += '%s '%(OTHER_TENS[number/10-2])
number = number%10
if number > 0:
out += '%s'%(FIRST_TEN[number-1])
if number == 0:
out = out[:len(out)-1]
return out
Aug. 3, 2015