Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First - Speech Module solution in Clear category for Speech Module by AQiccl135
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):
firstDigit = int(number/100)
secondDigit = int((number%100 - number%10) / 10)
thirdDigit = number % 10
text = ""
if firstDigit > 0:
text += FIRST_TEN[firstDigit - 1] + ' ' + HUNDRED + ' '
if secondDigit > 1:
text += OTHER_TENS[secondDigit - 2] + ' '
elif secondDigit == 1:
text += SECOND_TEN[thirdDigit]
if secondDigit != 1 and thirdDigit != 0:
text += FIRST_TEN[thirdDigit - 1]
return text.strip()
Oct. 6, 2014
Comments: