Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Clear category for The Secret Room by Tinus_Trotyl
TO20 = ("", "one ", "two ", "three ", "four ", "five ", "six ", "seven ", "eight ", "nine ", "ten ", "eleven ",
"twelve ", "thirteen ", "fourteen ", "fifteen ", "sixteen ", "seventeen ", "eighteen ", "nineteen ")
UP20 = ("", "", "twenty ", "thirty ", "forty ", "fifty ", "sixty ", "seventy ", "eighty ", "ninety ")
def say_number(n):
if n == 1000: return "one thousand"
return ((TO20[n//100]+"hundred "if n//100else"")+(TO20[n%20]if n%100<20else UP20[n//10%10]+TO20[n%10]))[:-1]
def secret_room(number):
names = ','.join((say_number(i) for i in range(1, number+1))).split(',')
return (sorted(names).index(say_number(number))) + 1
Sept. 11, 2018
Comments: