Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
letterify it solution in Clear category for The Secret Room by quarkov
lone = {0: "", 1: "one", 2: "two", 3: "three", 4: "four", 5: "five",
6: "six", 7: "seven", 8: "eight", 9: "nine"}
comp = {0: "", 2: "twenty", 3: "thirty", 4: "forty", 5: "fifty",
6: "sixty", 7: "seventy", 8: "eighty", 9: "ninety"}
un = {10: "ten", 11: "eleven", 12: "twelve", 13: "thirteen",
14: "fourteen", 15: "fifteen", 16: "sixteen ",
17: "seventeen", 18: "eighteen", 19: "nineteen"}
def letterify(n):
letterified = []
letterified.append("one thousand") if n//1000 else []
n %= 1000
letterified.append(lone[n//100] + " hundred") if n//100 else []
n %= 100
letterified.append(" " + un[n]) if n in un.keys() else\
letterified.append(" " + lone[n % 10]) if not n//10 else\
letterified.append(" " + comp[n//10] + " " + lone[n % 10])
return "".join(letterified).strip()
def secret_room(number):
doors = []
for i in range(1, number+1):
doors.append(letterify(i))
doors.sort()
return (doors.index(letterify(number)) + 1)
Sept. 11, 2018