Решение на Пет функции от Христо Петков
Обратно към всички решения
Към профила на Христо Петков
Резултати
- 6 точки от тестове
- 0 бонус точки
- 6 точки общо
- 10 успешни тест(а)
- 6 неуспешни тест(а)
Код
Лог от изпълнението
EEEE..........EE
======================================================================
ERROR: test_list_of_latin_anagrams (test.TestAnagrams)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-upiqap/test.py", line 109, in test_list_of_latin_anagrams
set(map(frozenset, solution.anagrams(words))))
File "/tmp/d20140319-21201-upiqap/solution.py", line 39, in anagrams
if is_anagram(i,j):
File "/tmp/d20140319-21201-upiqap/solution.py", line 45, in is_anagram
first_word = re.sub('[\W\d_+]', '', first_word)
NameError: global name 're' is not defined
======================================================================
ERROR: test_with_different_cases (test.TestAnagrams)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-upiqap/test.py", line 125, in test_with_different_cases
set(map(frozenset, solution.anagrams(words))))
File "/tmp/d20140319-21201-upiqap/solution.py", line 39, in anagrams
if is_anagram(i,j):
File "/tmp/d20140319-21201-upiqap/solution.py", line 45, in is_anagram
first_word = re.sub('[\W\d_+]', '', first_word)
NameError: global name 're' is not defined
======================================================================
ERROR: test_with_different_symbols (test.TestAnagrams)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-upiqap/test.py", line 135, in test_with_different_symbols
set(map(frozenset, solution.anagrams(words))))
File "/tmp/d20140319-21201-upiqap/solution.py", line 39, in anagrams
if is_anagram(i,j):
File "/tmp/d20140319-21201-upiqap/solution.py", line 45, in is_anagram
first_word = re.sub('[\W\d_+]', '', first_word)
NameError: global name 're' is not defined
======================================================================
ERROR: test_with_list_of_cyrilic_anagrams (test.TestAnagrams)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-upiqap/test.py", line 117, in test_with_list_of_cyrilic_anagrams
set(map(frozenset, solution.anagrams(words))))
File "/tmp/d20140319-21201-upiqap/solution.py", line 39, in anagrams
if is_anagram(i,j):
File "/tmp/d20140319-21201-upiqap/solution.py", line 45, in is_anagram
first_word = re.sub('[\W\d_+]', '', first_word)
NameError: global name 're' is not defined
======================================================================
ERROR: test_sort_by_one_element (test.TestSortBy)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-upiqap/test.py", line 57, in test_sort_by_one_element
self.assertEqual([1], solution.sort_by(lambda x, y: x - y, [1]))
File "/tmp/d20140319-21201-upiqap/solution.py", line 16, in sort_by
arg = sorted(arg, key = lambda x: item_value(x, arg, func))
File "/tmp/d20140319-21201-upiqap/solution.py", line 16, in <lambda>
arg = sorted(arg, key = lambda x: item_value(x, arg, func))
File "/tmp/d20140319-21201-upiqap/solution.py", line 21, in item_value
for i in item:
TypeError: 'int' object is not iterable
======================================================================
ERROR: test_sort_by_simple_test (test.TestSortBy)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-upiqap/test.py", line 54, in test_sort_by_simple_test
solution.sort_by(lambda x, y: x % 2 - y % 2, [0, 1, 2, 3, 4, 5]))
File "/tmp/d20140319-21201-upiqap/solution.py", line 16, in sort_by
arg = sorted(arg, key = lambda x: item_value(x, arg, func))
File "/tmp/d20140319-21201-upiqap/solution.py", line 16, in <lambda>
arg = sorted(arg, key = lambda x: item_value(x, arg, func))
File "/tmp/d20140319-21201-upiqap/solution.py", line 21, in item_value
for i in item:
TypeError: 'int' object is not iterable
----------------------------------------------------------------------
Ran 16 tests in 0.011s
FAILED (errors=6)
История (3 версии и 4 коментара)
Христо обнови решението на 15.03.2014 19:29 (преди над 10 години)
Христо обнови решението на 17.03.2014 11:10 (преди над 10 години)
Христо обнови решението на 19.03.2014 01:55 (преди над 10 години)