Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Speech Module by magda_kudrycka
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 ponizejsto (number):
numer = ""
if number < 10:
numer = FIRST_TEN[number-1]
return numer
elif number < 20:
numer = SECOND_TEN[number-10]
return numer
else:
numer = OTHER_TENS[number // 10 - 2]
if number % 10 > 0:
numer = numer + ' ' + FIRST_TEN[number % 10 - 1]
return numer
def checkio(number):
liczba = ""
if (number < 100):
liczba = ponizejsto(number)
return liczba
else:
liczba = FIRST_TEN[number // 100 - 1] + " " + HUNDRED
if number % 100 > 0:
liczba += ' ' + ponizejsto(number % 100)
return liczba
Nov. 27, 2016