Георги обнови решението на 17.03.2014 17:30 (преди над 10 години)
+def is_pangram(sentance, alphabet='абвгдежзийклмнопрстуфхцчшщьъюя'):
+ return not False in map(lambda x: x in sentance, list(alphabet))
Към профила на Георги Харизанов
.FF............. ====================================================================== FAIL: 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-1xhh0ti/test.py", line 125, in test_with_different_cases set(map(frozenset, solution.anagrams(words)))) AssertionError: Items in the first set but not the second: frozenset({'Ray Adverb', 'Dave Barry'}) Items in the second set but not the first: frozenset() ====================================================================== FAIL: 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-1xhh0ti/test.py", line 135, in test_with_different_symbols set(map(frozenset, solution.anagrams(words)))) AssertionError: Items in the first set but not the second: frozenset({'I am Lord Voldemort', 'Tom Marvolo Riddle'}) frozenset({'Tom Cruise', "So I'm cuter"}) Items in the second set but not the first: frozenset() ---------------------------------------------------------------------- Ran 16 tests in 0.015s FAILED (failures=2)
В случая е хубаво да изкараш азбуката като константа, а не да я подаваш като аргумент
Разбирам, но използвам функцията is_pangram за да реша задачата anagrams