|
|
вернуться в форумWhat is wrong? 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? It's strange but it works for Python3 (with corrections for print and input). |
|
|