Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Speech Module by indentationerror
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):
c=0
a=''
for i in range(1,10):
if number//100==i:
a=a+FIRST_TEN[i]+' '+HUNDRED
for i in range(2,10):
if number//10-(number//100)*10==i:
if number//100==0:
a=a+OTHER_TENS[i]
else:
a= a+' '+OTHER_TENS[i]
if number//10-(number//100)*10==1:
for i in range(10):
if number-number//10*10==i:
if number//100==0:
a=a+SECOND_TEN[i]
else:
a= a+' '+SECOND_TEN[i]
c=c+1
for i in range(1,10):
if number-number//10*10==i:
if number//100==0 and number//10==0:
a=a+FIRST_TEN[i]
else:
if c==0:
a= a+' '+FIRST_TEN[i]
return a
Dec. 18, 2015