ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1785. Lost in Localization

What is wrong?
Posted by pimiento 23 Sep 2013 20:06
truth_table = {
    'few': lambda x: x > 0 and x < 5,
    'several': lambda x: x > 4 and x < 10,
    'pack': lambda x: x > 9 and x < 20,
    'lots': lambda x: x > 19 and x < 50,
    'horde': lambda x: x > 49 and x < 100,
    'throng': lambda x: x > 99 and x < 250,
    'swarm': lambda x: x > 249 and x < 500,
    'zounds': lambda x: x > 499 and x < 1000,
    'legion': lambda x: x > 999
}

def translate_count(count):
    for result, func in truth_table.items():
        if func(count):
            return result


translate_count(raw_input(u"Number: "))


Проверку локально проходит, может нужно не так обрабатывать входные параметры?
Re: What is wrong?
Posted by pimiento 24 Sep 2013 01:52
It's strange but it works for Python3 (with corrections for print and input).