Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Clear category for Speech Module by dashrek1
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(n):
n,j=str(n).zfill(3),""
if int(n[0])>0:j+=FIRST_TEN[int(n[0])-1]+" "+HUNDRED+" ";
if int(n[1])>1:
j+=OTHER_TENS[int(n[1])-2]+" ";
if int(n[1])==1:j+=SECOND_TEN[int(n[2])];
if int(n[1])!=1 and int(n[2])>0:j+=FIRST_TEN[int(n[2])-1];
if j[-1]==" ":j=j[0:len(j)-1];
return j
Aug. 29, 2019