Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
*Numbers to Words solution in Clear category for Speech Module by JimmyCarlos
SMALL_NUMBERS = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen",
"seventeen", "eighteen", "nineteen"]
TENS = ["zero", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
def checkio(n):
s = ""
if n >= 100:
s += "{} hundred ".format(SMALL_NUMBERS[n//100])
n %= 100
if n >= 20:
s += "{} ".format(TENS[n//10])
n %= 10
if n > 0:
s += "{} ".format(SMALL_NUMBERS[n])
n = 0
return s.strip()
June 29, 2019
Comments: