Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Speech Module by TovarischZhukov
data = {0: "",
0.1: " one",
0.2: " two",
0.3: " three",
0.4: " four",
0.5: " five",
0.6: " six",
0.7: " seven",
0.8: " eight",
0.9: " nine",
1: " ten",
1.1: " eleven",
1.2: " twelve",
1.3: " thirteen",
1.4: " fourteen",
1.5: " fifteen",
1.6: " sixteen",
1.7: " seventeen",
1.8: " eighteen",
1.9: " nineteen"}
for i in range(10):
if i:
data.update({i*10:" %s %s" % (data[i/10.0], "hundred")})
data.update({2+i/10.0:" twenty"+ data[i/10.0]})
data.update({3+i/10.0:" thirty"+ data[i/10.0]})
data.update({4+i/10.0:" forty"+ data[i/10.0]})
data.update({5+i/10.0:" fifty"+ data[i/10.0]})
data.update({6+i/10.0:" sixty"+ data[i/10.0]})
data.update({7+i/10.0:" seventy"+ data[i/10.0]})
data.update({8+i/10.0:" eighty"+ data[i/10.0]})
data.update({9+i/10.0:" ninety"+ data[i/10.0]})
def checkio(number):
val =(data[(number-(number % 100))/10] + data[(number % 100) / 10.0]).strip()
return val if val else "zero"
Dec. 5, 2015